* 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/avrdude@1053 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
2f9a27cd3f
commit
ff577a6fed
|
@ -1,3 +1,9 @@
|
|||
2012-01-31 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* 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 <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7437 modifications to Bus Pirate module
|
||||
|
|
42
config.c
42
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, "<other>");
|
||||
break;
|
||||
}
|
||||
|
|
2
config.h
2
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);
|
||||
|
|
|
@ -200,7 +200,6 @@ static int pin_name;
|
|||
%token TKN_TILDE
|
||||
%token TKN_NUMBER
|
||||
%token TKN_STRING
|
||||
%token TKN_ID
|
||||
|
||||
%start configuration
|
||||
|
||||
|
|
Loading…
Reference in New Issue