From 78caacd7cccca723d900da1511d5a7713104c6a4 Mon Sep 17 00:00:00 2001 From: Rene Liebscher Date: Tue, 31 Jan 2012 19:28:01 +0000 Subject: [PATCH] * config_gram.y, lexer.l: removed unused ID/TKN_ID definitions * config.[hc]: removed unused function id(), use value.type to select values git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@1053 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrdude/ChangeLog | 6 ++++++ avrdude/config.c | 42 ++++++------------------------------------ avrdude/config.h | 2 -- avrdude/config_gram.y | 1 - avrdude/lexer.l | 1 - 5 files changed, 12 insertions(+), 40 deletions(-) diff --git a/avrdude/ChangeLog b/avrdude/ChangeLog index 5ffb809a..f1c9c882 100644 --- a/avrdude/ChangeLog +++ b/avrdude/ChangeLog @@ -1,3 +1,9 @@ +2012-01-31 Rene Liebscher + + * config_gram.y, lexer.l: removed unused ID/TKN_ID definitions + * config.[hc]: removed unused function id(), use value.type to select + values + 2012-01-31 Rene Liebscher patch #7437 modifications to Bus Pirate module diff --git a/avrdude/config.c b/avrdude/config.c index 838a226e..7da6531c 100644 --- a/avrdude/config.c +++ b/avrdude/config.c @@ -115,9 +115,8 @@ TOKEN * new_token(int primary) void free_token(TOKEN * tkn) { if (tkn) { - switch (tkn->primary) { - case TKN_STRING: - case TKN_ID: + switch (tkn->value.type) { + case V_STR: if (tkn->value.string) free(tkn->value.string); tkn->value.string = NULL; @@ -207,31 +206,6 @@ TOKEN * string(char * text) } -TOKEN * id(char * text) -{ - struct token_t * tkn; - int len; - - tkn = new_token(TKN_ID); - - len = strlen(text); - - tkn->value.type = V_STR; - tkn->value.string = (char *) malloc(len+1); - if (tkn->value.string == NULL) { - fprintf(stderr, "id(): out of memory\n"); - exit(1); - } - strcpy(tkn->value.string, text); - -#if DEBUG - fprintf(stderr, "ID(%s)\n", tkn->value.string); -#endif - - return tkn; -} - - TOKEN * keyword(int primary) { struct token_t * tkn; @@ -248,20 +222,16 @@ void print_token(TOKEN * tkn) return; fprintf(stderr, "token = %d = ", tkn->primary); - switch (tkn->primary) { - case TKN_NUMBER: + switch (tkn->value.type) { + case V_NUM: fprintf(stderr, "NUMBER, value=%g", tkn->value.number); break; - case TKN_STRING: + case V_STR: fprintf(stderr, "STRING, value=%s", tkn->value.string); break; - case TKN_ID: - fprintf(stderr, "ID, value=%s", tkn->value.string); - break; - - default: + default: fprintf(stderr, ""); break; } diff --git a/avrdude/config.h b/avrdude/config.h index 5abd7220..13566413 100644 --- a/avrdude/config.h +++ b/avrdude/config.h @@ -95,8 +95,6 @@ TOKEN * hexnumber(char * text); TOKEN * string(char * text); -TOKEN * id(char * text); - TOKEN * keyword(int primary); void print_token(TOKEN * tkn); diff --git a/avrdude/config_gram.y b/avrdude/config_gram.y index b20d545a..1c1c79bb 100644 --- a/avrdude/config_gram.y +++ b/avrdude/config_gram.y @@ -200,7 +200,6 @@ static int pin_name; %token TKN_TILDE %token TKN_NUMBER %token TKN_STRING -%token TKN_ID %start configuration diff --git a/avrdude/lexer.l b/avrdude/lexer.l index e684e69d..184c3e76 100644 --- a/avrdude/lexer.l +++ b/avrdude/lexer.l @@ -43,7 +43,6 @@ DIGIT [0-9] HEXDIGIT [0-9a-fA-F] -ID [_a-zA-Z][_a-zA-Z0-9]* SIGN [+-] %x strng