char *current_token = (char *)NULL;
extern char *table_name;
-char *ds(const char *string);
char *quote(const char *string);
void set_table_1num(char *string);
int char_to_1num(char c);
%%
error_table : ERROR_TABLE header error_codes END
- { table_name = ds($2);
+ { table_name = strdup($2);
current_token = table_name;
put_ecs(); }
;
$$ = $2; }
| table_id
{ current_token = $1;
- set_table_fun(ds("1"));
+ set_table_fun(strdup("1"));
$$ = $1;
}
;
;
ec_name : STRING
- { $$ = ds($1);
+ { $$ = strdup($1);
current_token = $$; }
;
description : QUOTED_STRING
- { $$ = ds($1);
+ { $$ = strdup($1);
current_token = $$; }
;
gettimeofday(&tv, (void *)0);
gensym_n = (tv.tv_sec%10000)*100 + tv.tv_usec/10000;
}
- symbol = (char *)malloc(32 * sizeof(char));
+ symbol = malloc(32 * sizeof(char));
gensym_n++;
sprintf(symbol, "et%ld", (long int) gensym_n);
return(symbol);
}
char *
-ds(const char *string)
-{
- char *rv;
- rv = (char *)malloc(strlen(string)+1);
- strcpy(rv, string);
- return(rv);
-}
-
-char *
quote(const char *string)
{
char *rv;
- rv = (char *)malloc(strlen(string)+3);
+ rv = malloc(strlen(string)+3);
strcpy(rv, "\"");
strcat(rv, string);
strcat(rv, "\"");
fprintf(cfile, "\t\"%s\",\n", description);
}
if (error_codes == (char **)NULL) {
- error_codes = (char **)malloc(sizeof(char *));
+ error_codes = malloc(sizeof(char *));
*error_codes = (char *)NULL;
}
error_codes = (char **)realloc((char *)error_codes,
(current + 2)*sizeof(char *));
- error_codes[current++] = ds(name);
+ error_codes[current++] = strdup(name);
error_codes[current] = (char *)NULL;
}
fprintf(cfile, "\t\"%s\",\n", description);
}
if (error_codes == (char **)NULL) {
- error_codes = (char **)malloc(sizeof(char *));
+ error_codes = malloc(sizeof(char *));
*error_codes = (char *)NULL;
}
error_codes = (char **)realloc((char *)error_codes,
(current + 2)*sizeof(char *));
- error_codes[current++] = ds(name);
+ error_codes[current++] = strdup(name);
error_codes[current] = (char *)NULL;
}
void set_table_fun(char *astring)
{
- register char *tp;
+ char *tp;
unsigned int tc;
for(tp=astring; (tc = *tp) != 0; tp++) {