Clean up hex() and octal() to return and work with unsigned integers since

they scan values of unsigned types, and since they do not need otherwise,
have them take const char * arguments.
This commit is contained in:
Juli Mallett 2002-06-21 10:56:44 +00:00
parent 796851bb71
commit e872716d8a

View File

@ -84,8 +84,8 @@ struct kt {
static int endinclude(void);
int include(const char *, int);
int kw_lookup(char *);
int octal(char *);
int hex(char *);
unsigned int octal(const char *);
unsigned int hex(const char *);
int yyerror(const char *);
%}
@ -198,19 +198,19 @@ kw_lookup(char *word)
* Number conversion routines
*/
int
octal(char *str)
unsigned int
octal(const char *str)
{
int num;
unsigned int num;
(void) sscanf(str, "%o", &num);
return num;
}
int
hex(char *str)
unsigned int
hex(const char *str)
{
int num;
unsigned int num;
(void) sscanf(str+2, "%x", &num);
return num;