From: pmf Date: Fri, 1 Jun 2007 22:04:58 +0000 (+0000) Subject: add support for hex values in facility enums X-Git-Tag: v0.12.20~958 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b868b8b881e69a12b725d4363a188d4eff7b74dc;p=lttv.git add support for hex values in facility enums git-svn-id: http://ltt.polymtl.ca/svn@2531 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/genevent/parser.c b/genevent/parser.c index 25fabab5..0b725ecc 100644 --- a/genevent/parser.c +++ b/genevent/parser.c @@ -436,7 +436,7 @@ char *getNameAttribute(parse_file_t *in) //Return value : 0 : no value, 1 : has a value int getValueAttribute(parse_file_t *in, long long *value) { - char * token, *token2; + char * token, * endptr; token = getToken(in); @@ -449,24 +449,12 @@ int getValueAttribute(parse_file_t *in, long long *value) getEqual(in); token = getToken(in); - if(in->type == QUOTEDSTRING) { - in->type = NUMBER; - token2 = token; - do { - if (!isdigit(*token2)) { - in->type = QUOTEDSTRING; - break; - } - } while (*(++token2) != '\0'); - } - - if(in->type == NUMBER) - *value = strtoll(token, NULL, 0); - else + *value = strtoll(token, &endptr, 0); + if(*endptr != '\0') goto error; return 1; error: - in->error(in,"incorrect size specification"); + in->error(in,"invalid number specified"); return 0; } diff --git a/ltt/branches/poly/ltt/parser.c b/ltt/branches/poly/ltt/parser.c index 25fabab5..0b725ecc 100644 --- a/ltt/branches/poly/ltt/parser.c +++ b/ltt/branches/poly/ltt/parser.c @@ -436,7 +436,7 @@ char *getNameAttribute(parse_file_t *in) //Return value : 0 : no value, 1 : has a value int getValueAttribute(parse_file_t *in, long long *value) { - char * token, *token2; + char * token, * endptr; token = getToken(in); @@ -449,24 +449,12 @@ int getValueAttribute(parse_file_t *in, long long *value) getEqual(in); token = getToken(in); - if(in->type == QUOTEDSTRING) { - in->type = NUMBER; - token2 = token; - do { - if (!isdigit(*token2)) { - in->type = QUOTEDSTRING; - break; - } - } while (*(++token2) != '\0'); - } - - if(in->type == NUMBER) - *value = strtoll(token, NULL, 0); - else + *value = strtoll(token, &endptr, 0); + if(*endptr != '\0') goto error; return 1; error: - in->error(in,"incorrect size specification"); + in->error(in,"invalid number specified"); return 0; }