vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On Thu, Oct 05, 2006 at 03:16:54PM +0200, Pierre-Yves Ritschard wrote: >> - if (atoul($1, &ulval) == -1) { >> + ulval = strtonum($1, 0, UINT_MAX, &errstr); >> + if (errstr) { >> yyerror("\"%s\" is not a number", $1); >> free($1); >> YYERROR; > > You have errstr, why not using it. I didn't want to modify the behavior of the application. It would make sense in this case though. >> if (strcmp(s, "neighbor-as") == 0) >> return (COMMUNITY_NEIGHBOR_AS); >> - if (atoul(s, &ulval) == -1) { >> - yyerror("\"%s\" is not a number", s); >> - return (COMMUNITY_ERROR); >> - } >> - if (ulval > USHRT_MAX) { >> - yyerror("Community too big: max %u", USHRT_MAX); >> + ulval = strtonum(s, 0, USHRT_MAX, &errstr); >> + if (errstr) { >> + if (errno == ERANGE) >> + yyerror("Community too big: max %u", USHRT_MAX); >> + else >> + yyerror("\"%s\" is not a number", s); > >Same here, etc, pp and so on. It wouldn't make sense here as the error message isn't as useful as saying that the community is too big. |
| Thread Tools | |
| Display Modes | |
|
|