aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/yacc
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2010-11-07 23:22:42 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2010-11-07 23:22:42 +0000
commit92a010d28be0f65fee1e21c8706399955ee8752d (patch)
tree6599125003adb8e7b98cfa2dddb32d804f064fdb /usr.bin/yacc
parentc8f6c2ae321b8b2cffb24e5cd184c32d8906b73b (diff)
downloadsrc-92a010d28be0f65fee1e21c8706399955ee8752d.tar.gz
src-92a010d28be0f65fee1e21c8706399955ee8752d.zip
Notes
Diffstat (limited to 'usr.bin/yacc')
-rw-r--r--usr.bin/yacc/closure.c8
-rw-r--r--usr.bin/yacc/defs.h8
-rw-r--r--usr.bin/yacc/lalr.c30
-rw-r--r--usr.bin/yacc/lr0.c24
-rw-r--r--usr.bin/yacc/main.c22
-rw-r--r--usr.bin/yacc/mkpar.c6
-rw-r--r--usr.bin/yacc/output.c54
-rw-r--r--usr.bin/yacc/reader.c102
-rw-r--r--usr.bin/yacc/skeleton.c8
-rw-r--r--usr.bin/yacc/symtab.c10
-rw-r--r--usr.bin/yacc/verbose.c4
11 files changed, 136 insertions, 140 deletions
diff --git a/usr.bin/yacc/closure.c b/usr.bin/yacc/closure.c
index 9b7ed80cfb5c..2aadb38e6a0c 100644
--- a/usr.bin/yacc/closure.c
+++ b/usr.bin/yacc/closure.c
@@ -149,7 +149,7 @@ set_first_derives(void)
print_first_derives();
#endif
- FREE(EFF);
+ free(EFF);
}
@@ -224,9 +224,9 @@ closure(short *nucleus, int n)
void
finalize_closure(void)
{
- FREE(itemset);
- FREE(ruleset);
- FREE(first_derives + ntokens * WORDSIZE(nrules));
+ free(itemset);
+ free(ruleset);
+ free(first_derives + ntokens * WORDSIZE(nrules));
}
diff --git a/usr.bin/yacc/defs.h b/usr.bin/yacc/defs.h
index 772e9129caaa..2fdac73ed13b 100644
--- a/usr.bin/yacc/defs.h
+++ b/usr.bin/yacc/defs.h
@@ -133,12 +133,8 @@
/* storage allocation macros */
-#define CALLOC(k,n) (calloc((unsigned)(k),(unsigned)(n)))
-#define FREE(x) (free((char*)(x)))
-#define MALLOC(n) (malloc((unsigned)(n)))
#define NEW(t) ((t*)allocate(sizeof(t)))
-#define NEW2(n,t) ((t*)allocate((unsigned)((n)*sizeof(t))))
-#define REALLOC(p,n) (realloc((char*)(p),(unsigned)(n)))
+#define NEW2(n,t) ((t*)allocate((n)*sizeof(t)))
/* the structure of a symbol table entry */
@@ -304,7 +300,7 @@ extern short final_state;
/* global functions */
-char *allocate(unsigned);
+void *allocate(size_t);
void closure(short *, int);
void create_symbol_table(void);
void default_action_warning(void);
diff --git a/usr.bin/yacc/lalr.c b/usr.bin/yacc/lalr.c
index 21bae484963d..1b62237e5022 100644
--- a/usr.bin/yacc/lalr.c
+++ b/usr.bin/yacc/lalr.c
@@ -293,7 +293,7 @@ set_goto_map(void)
}
}
- FREE(temp_map + ntokens);
+ free(temp_map + ntokens);
}
@@ -396,11 +396,11 @@ initialize_F(void)
for (i = 0; i < ngotos; i++)
{
if (reads[i])
- FREE(reads[i]);
+ free(reads[i]);
}
- FREE(reads);
- FREE(edge);
+ free(reads);
+ free(edge);
}
@@ -487,14 +487,14 @@ build_relations(void)
for (i = 0; i < ngotos; i++)
if (includes[i])
- FREE(includes[i]);
+ free(includes[i]);
- FREE(includes);
+ free(includes);
includes = new_includes;
- FREE(edge);
- FREE(states);
+ free(edge);
+ free(states);
}
@@ -562,7 +562,7 @@ transpose(short **R, int n)
}
}
- FREE(nedges);
+ free(nedges);
for (i = 0; i < n; i++)
{
@@ -574,7 +574,7 @@ transpose(short **R, int n)
}
}
- FREE(temp_R);
+ free(temp_R);
return (new_R);
}
@@ -615,11 +615,11 @@ compute_lookaheads(void)
for (sp = lookback[i]; sp; sp = next)
{
next = sp->next;
- FREE(sp);
+ free(sp);
}
- FREE(lookback);
- FREE(F);
+ free(lookback);
+ free(F);
}
@@ -642,8 +642,8 @@ digraph(short **relation)
traverse(i, relation);
}
- FREE(INDEX);
- FREE(VERTICES);
+ free(INDEX);
+ free(VERTICES);
}
diff --git a/usr.bin/yacc/lr0.c b/usr.bin/yacc/lr0.c
index e092bfb5e4d6..a8035e657b27 100644
--- a/usr.bin/yacc/lr0.c
+++ b/usr.bin/yacc/lr0.c
@@ -176,13 +176,13 @@ append_states(void)
static void
free_storage(void)
{
- FREE(shift_symbol);
- FREE(redset);
- FREE(shiftset);
- FREE(kernel_base);
- FREE(kernel_end);
- FREE(kernel_items);
- FREE(state_set);
+ free(shift_symbol);
+ free(redset);
+ free(shiftset);
+ free(kernel_base);
+ free(kernel_end);
+ free(kernel_items);
+ free(state_set);
}
@@ -290,7 +290,7 @@ initialize_states(void)
for (i = 0; start_derives[i] >= 0; ++i)
continue;
- p = (core *) MALLOC(sizeof(core) + i*sizeof(short));
+ p = malloc(sizeof(core) + i*sizeof(short));
if (p == 0) no_space();
p->next = 0;
@@ -579,8 +579,8 @@ set_derives(void)
#if 0
free_derives()
{
- FREE(derives[start_symbol]);
- FREE(derives);
+ free(derives[start_symbol]);
+ free(derives);
}
#endif
@@ -615,7 +615,7 @@ set_nullable(void)
int empty;
int done1;
- nullable = MALLOC(nsyms);
+ nullable = malloc(nsyms);
if (nullable == 0) no_space();
for (i = 0; i < nsyms; ++i)
@@ -661,7 +661,7 @@ set_nullable(void)
#if 0
free_nullable(void)
{
- FREE(nullable);
+ free(nullable);
}
#endif
diff --git a/usr.bin/yacc/main.c b/usr.bin/yacc/main.c
index d01d6bf6610a..96924c18dc33 100644
--- a/usr.bin/yacc/main.c
+++ b/usr.bin/yacc/main.c
@@ -216,15 +216,15 @@ getargs(int argc, char *argv[])
}
-char *
-allocate(unsigned n)
+void *
+allocate(size_t n)
{
- char *p;
+ void *p;
p = NULL;
if (n)
{
- p = CALLOC(1, n);
+ p = calloc(1, n);
if (!p) no_space();
}
return (p);
@@ -245,11 +245,11 @@ create_file_names(void)
if (len && tmpdir[len-1] != '/')
++i;
- action_file_name = MALLOC(i);
+ action_file_name = malloc(i);
if (action_file_name == 0) no_space();
- text_file_name = MALLOC(i);
+ text_file_name = malloc(i);
if (text_file_name == 0) no_space();
- union_file_name = MALLOC(i);
+ union_file_name = malloc(i);
if (union_file_name == 0) no_space();
strcpy(action_file_name, tmpdir);
@@ -280,7 +280,7 @@ create_file_names(void)
else
{
len = strlen(file_prefix);
- output_file_name = MALLOC(len + 7);
+ output_file_name = malloc(len + 7);
if (output_file_name == 0)
no_space();
strcpy(output_file_name, file_prefix);
@@ -289,7 +289,7 @@ create_file_names(void)
if (rflag)
{
- code_file_name = MALLOC(len + 8);
+ code_file_name = malloc(len + 8);
if (code_file_name == 0)
no_space();
strcpy(code_file_name, file_prefix);
@@ -314,7 +314,7 @@ create_file_names(void)
if (dflag)
{
- defines_file_name = MALLOC(len + 7);
+ defines_file_name = malloc(len + 7);
if (defines_file_name == 0)
no_space();
strcpy(defines_file_name, file_prefix);
@@ -332,7 +332,7 @@ create_file_names(void)
if (vflag)
{
- verbose_file_name = MALLOC(len + 8);
+ verbose_file_name = malloc(len + 8);
if (verbose_file_name == 0)
no_space();
strcpy(verbose_file_name, file_prefix);
diff --git a/usr.bin/yacc/mkpar.c b/usr.bin/yacc/mkpar.c
index 282b6a1584fa..8e897a2135e2 100644
--- a/usr.bin/yacc/mkpar.c
+++ b/usr.bin/yacc/mkpar.c
@@ -221,7 +221,7 @@ unused_rules(void)
int i;
action *p;
- rules_used = (short *) MALLOC(nrules*sizeof(short));
+ rules_used = malloc(nrules*sizeof(short));
if (rules_used == 0) no_space();
for (i = 0; i < nrules; ++i)
@@ -391,7 +391,7 @@ free_action_row(action *p)
while (p)
{
q = p->next;
- FREE(p);
+ free(p);
p = q;
}
}
@@ -404,5 +404,5 @@ free_parser(void)
for (i = 0; i < nstates; i++)
free_action_row(parser[i]);
- FREE(parser);
+ free(parser);
}
diff --git a/usr.bin/yacc/output.c b/usr.bin/yacc/output.c
index b4839609967a..0e1a9ed3629f 100644
--- a/usr.bin/yacc/output.c
+++ b/usr.bin/yacc/output.c
@@ -270,15 +270,15 @@ output_actions(void)
width = NEW2(nvectors, short);
token_actions();
- FREE(lookaheads);
- FREE(LA);
- FREE(LAruleno);
- FREE(accessing_symbol);
+ free(lookaheads);
+ free(LA);
+ free(LAruleno);
+ free(accessing_symbol);
goto_actions();
- FREE(goto_map + ntokens);
- FREE(from_state);
- FREE(to_state);
+ free(goto_map + ntokens);
+ free(from_state);
+ free(to_state);
sort_actions();
pack_table();
@@ -370,7 +370,7 @@ token_actions(void)
}
}
}
- FREE(actionrow);
+ free(actionrow);
}
static void
@@ -403,7 +403,7 @@ goto_actions(void)
if (!rflag) outline += 2;
fprintf(output_file, "\n};\n");
- FREE(state_count);
+ free(state_count);
}
static int
@@ -555,14 +555,14 @@ pack_table(void)
for (i = 0; i < nvectors; i++)
{
if (froms[i])
- FREE(froms[i]);
+ free(froms[i]);
if (tos[i])
- FREE(tos[i]);
+ free(tos[i]);
}
- FREE(froms);
- FREE(tos);
- FREE(pos);
+ free(froms);
+ free(tos);
+ free(pos);
}
@@ -762,7 +762,7 @@ output_base(void)
if (!rflag) outline += 2;
fprintf(output_file, "\n};\n");
- FREE(base);
+ free(base);
}
@@ -795,7 +795,7 @@ output_table(void)
if (!rflag) outline += 2;
fprintf(output_file, "\n};\n");
- FREE(table);
+ free(table);
}
@@ -826,7 +826,7 @@ output_check(void)
if (!rflag) outline += 2;
fprintf(output_file, "\n};\n");
- FREE(check);
+ free(check);
}
@@ -972,7 +972,7 @@ output_debug(void)
++outline;
fprintf(code_file, "#define YYMAXTOKEN %d\n", max);
- symnam = (char **) MALLOC((max+1)*sizeof(char *));
+ symnam = malloc((max+1)*sizeof(char *));
if (symnam == 0) no_space();
/* Note that it is not necessary to initialize the element */
@@ -1108,7 +1108,7 @@ output_debug(void)
}
if (!rflag) outline += 2;
fprintf(output_file, "\n};\n");
- FREE(symnam);
+ free(symnam);
if (!rflag) ++outline;
fprintf(output_file, "const char * const %srule[] = {\n", symbol_prefix);
@@ -1278,11 +1278,11 @@ free_itemsets(void)
{
core *cp, *next;
- FREE(state_table);
+ free(state_table);
for (cp = first_state; cp; cp = next)
{
next = cp->next;
- FREE(cp);
+ free(cp);
}
}
@@ -1292,11 +1292,11 @@ free_shifts(void)
{
shifts *sp, *next;
- FREE(shift_table);
+ free(shift_table);
for (sp = first_shift; sp; sp = next)
{
next = sp->next;
- FREE(sp);
+ free(sp);
}
}
@@ -1307,11 +1307,11 @@ free_reductions(void)
{
reductions *rp, *next;
- FREE(reduction_table);
+ free(reduction_table);
for (rp = first_reduction; rp; rp = next)
{
next = rp->next;
- FREE(rp);
+ free(rp);
}
}
@@ -1332,9 +1332,9 @@ increase_maxtable(int loc)
newmax = maxtable;
do { newmax += 200; } while (newmax <= loc);
- table = (short *) REALLOC(table, newmax*sizeof(short));
+ table = realloc(table, newmax*sizeof(short));
if (table == 0) no_space();
- check = (short *) REALLOC(check, newmax*sizeof(short));
+ check = realloc(check, newmax*sizeof(short));
if (check == 0) no_space();
for (l = maxtable; l < newmax; ++l)
{
diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c
index c97098dd22c2..73178741639f 100644
--- a/usr.bin/yacc/reader.c
+++ b/usr.bin/yacc/reader.c
@@ -126,7 +126,7 @@ cachec(int c)
if (cinc >= cache_size)
{
cache_size += 256;
- cache = REALLOC(cache, cache_size);
+ cache = realloc(cache, cache_size);
if (cache == 0) no_space();
}
cache[cinc] = c;
@@ -143,7 +143,7 @@ get_line(void)
if (saw_eof || (c = getc(f)) == EOF)
{
- if (line) { FREE(line); line = 0; }
+ if (line) { free(line); line = 0; }
cptr = 0;
saw_eof = 1;
return;
@@ -151,9 +151,9 @@ get_line(void)
if (line == 0 || linesize != (LINESIZE + 1))
{
- if (line) FREE(line);
+ if (line) free(line);
linesize = LINESIZE + 1;
- line = MALLOC(linesize);
+ line = malloc(linesize);
if (line == 0) no_space();
}
@@ -166,7 +166,7 @@ get_line(void)
if (++i >= linesize)
{
linesize += LINESIZE;
- line = REALLOC(line, linesize);
+ line = realloc(line, linesize);
if (line == 0) no_space();
}
c = getc(f);
@@ -189,7 +189,7 @@ dup_line(void)
if (line == 0) return (0);
s = line;
while (*s != '\n') ++s;
- p = MALLOC(s - line + 1);
+ p = malloc(s - line + 1);
if (p == 0) no_space();
s = line;
@@ -214,7 +214,7 @@ skip_comment(void)
if (*s == '*' && s[1] == '/')
{
cptr = s + 2;
- FREE(st_line);
+ free(st_line);
return;
}
if (*s == '\n')
@@ -435,7 +435,7 @@ loop:
if (c == quote)
{
need_newline = 1;
- FREE(s_line);
+ free(s_line);
goto loop;
}
if (c == '\n')
@@ -487,7 +487,7 @@ loop:
{
putc('/', f);
++cptr;
- FREE(c_line);
+ free(c_line);
goto loop;
}
if (c == '\n')
@@ -507,7 +507,7 @@ loop:
{
if (need_newline) putc('\n', f);
++cptr;
- FREE(t_line);
+ free(t_line);
return;
}
/* FALLTHROUGH */
@@ -560,7 +560,7 @@ loop:
if (--depth == 0)
{
fprintf(text_file, " YYSTYPE;\n");
- FREE(u_line);
+ free(u_line);
return;
}
goto loop;
@@ -580,7 +580,7 @@ loop:
if (dflag) putc(c, union_file);
if (c == quote)
{
- FREE(s_line);
+ free(s_line);
goto loop;
}
if (c == '\n')
@@ -642,7 +642,7 @@ loop:
putc('/', text_file);
if (dflag) putc('/', union_file);
++cptr;
- FREE(c_line);
+ free(c_line);
goto loop;
}
if (c == '\n')
@@ -751,10 +751,10 @@ get_literal(void)
}
cachec(c);
}
- FREE(s_line);
+ free(s_line);
n = cinc;
- s = MALLOC(n);
+ s = malloc(n);
if (s == 0) no_space();
for (i = 0; i < n; ++i)
@@ -807,7 +807,7 @@ get_literal(void)
bp->class = TERM;
if (n == 1 && bp->value == UNDEFINED)
bp->value = *(unsigned char *)s;
- FREE(s);
+ free(s);
return (bp);
}
@@ -900,17 +900,17 @@ get_tag(void)
{
tagmax += 16;
tag_table = (char **)
- (tag_table ? REALLOC(tag_table, tagmax*sizeof(char *))
- : MALLOC(tagmax*sizeof(char *)));
+ (tag_table ? realloc(tag_table, tagmax*sizeof(char *))
+ : malloc(tagmax*sizeof(char *)));
if (tag_table == 0) no_space();
}
- s = MALLOC(cinc);
+ s = malloc(cinc);
if (s == 0) no_space();
strcpy(s, cache);
tag_table[ntags] = s;
++ntags;
- FREE(t_line);
+ free(t_line);
return (s);
}
@@ -1075,7 +1075,7 @@ read_declarations(void)
int c, k;
cache_size = 256;
- cache = MALLOC(cache_size);
+ cache = malloc(cache_size);
if (cache == 0) no_space();
for (;;)
@@ -1128,7 +1128,7 @@ initialize_grammar(void)
{
nitems = 4;
maxitems = 300;
- pitem = (bucket **) MALLOC(maxitems*sizeof(bucket *));
+ pitem = malloc(maxitems*sizeof(bucket *));
if (pitem == 0) no_space();
pitem[0] = 0;
pitem[1] = 0;
@@ -1137,17 +1137,17 @@ initialize_grammar(void)
nrules = 3;
maxrules = 100;
- plhs = (bucket **) MALLOC(maxrules*sizeof(bucket *));
+ plhs = malloc(maxrules*sizeof(bucket *));
if (plhs == 0) no_space();
plhs[0] = 0;
plhs[1] = 0;
plhs[2] = 0;
- rprec = (short *) MALLOC(maxrules*sizeof(short));
+ rprec = malloc(maxrules*sizeof(short));
if (rprec == 0) no_space();
rprec[0] = 0;
rprec[1] = 0;
rprec[2] = 0;
- rassoc = (char *) MALLOC(maxrules*sizeof(char));
+ rassoc = malloc(maxrules*sizeof(char));
if (rassoc == 0) no_space();
rassoc[0] = TOKEN;
rassoc[1] = TOKEN;
@@ -1159,7 +1159,7 @@ static void
expand_items(void)
{
maxitems += 300;
- pitem = (bucket **) REALLOC(pitem, maxitems*sizeof(bucket *));
+ pitem = realloc(pitem, maxitems*sizeof(bucket *));
if (pitem == 0) no_space();
}
@@ -1168,11 +1168,11 @@ static void
expand_rules(void)
{
maxrules += 100;
- plhs = (bucket **) REALLOC(plhs, maxrules*sizeof(bucket *));
+ plhs = realloc(plhs, maxrules*sizeof(bucket *));
if (plhs == 0) no_space();
- rprec = (short *) REALLOC(rprec, maxrules*sizeof(short));
+ rprec = realloc(rprec, maxrules*sizeof(short));
if (rprec == 0) no_space();
- rassoc = (char *) REALLOC(rassoc, maxrules*sizeof(char));
+ rassoc = realloc(rassoc, maxrules*sizeof(char));
if (rassoc == 0) no_space();
}
@@ -1367,7 +1367,7 @@ loop:
{
fprintf(f, "yyval.%s", tag);
++cptr;
- FREE(d_line);
+ free(d_line);
goto loop;
}
else if (isdigit(c))
@@ -1375,7 +1375,7 @@ loop:
i = get_number();
if (i > n) dollar_warning(d_lineno, i);
fprintf(f, "yyvsp[%d].%s", i - n, tag);
- FREE(d_line);
+ free(d_line);
goto loop;
}
else if (c == '-' && isdigit(cptr[1]))
@@ -1383,7 +1383,7 @@ loop:
++cptr;
i = -get_number() - n;
fprintf(f, "yyvsp[%d].%s", i, tag);
- FREE(d_line);
+ free(d_line);
goto loop;
}
else
@@ -1479,7 +1479,7 @@ loop:
putc(c, f);
if (c == quote)
{
- FREE(s_line);
+ free(s_line);
goto loop;
}
if (c == '\n')
@@ -1529,7 +1529,7 @@ loop:
{
putc('/', f);
++cptr;
- FREE(c_line);
+ free(c_line);
goto loop;
}
if (c == '\n')
@@ -1636,9 +1636,9 @@ free_tags(void)
for (i = 0; i < ntags; ++i)
{
assert(tag_table[i]);
- FREE(tag_table[i]);
+ free(tag_table[i]);
}
- FREE(tag_table);
+ free(tag_table);
}
@@ -1651,7 +1651,7 @@ pack_names(void)
name_pool_size = 13; /* 13 == sizeof("$end") + sizeof("$accept") */
for (bp = first_symbol; bp; bp = bp->next)
name_pool_size += strlen(bp->name) + 1;
- name_pool = MALLOC(name_pool_size);
+ name_pool = malloc(name_pool_size);
if (name_pool == 0) no_space();
strcpy(name_pool, "$accept");
@@ -1662,7 +1662,7 @@ pack_names(void)
p = t;
s = bp->name;
while ((*t++ = *s++)) continue;
- FREE(bp->name);
+ free(bp->name);
bp->name = p;
}
}
@@ -1704,16 +1704,16 @@ pack_symbols(void)
start_symbol = ntokens;
nvars = nsyms - ntokens;
- symbol_name = (char **) MALLOC(nsyms*sizeof(char *));
+ symbol_name = malloc(nsyms*sizeof(char *));
if (symbol_name == 0) no_space();
- symbol_value = (short *) MALLOC(nsyms*sizeof(short));
+ symbol_value = malloc(nsyms*sizeof(short));
if (symbol_value == 0) no_space();
- symbol_prec = (short *) MALLOC(nsyms*sizeof(short));
+ symbol_prec = malloc(nsyms*sizeof(short));
if (symbol_prec == 0) no_space();
- symbol_assoc = MALLOC(nsyms);
+ symbol_assoc = malloc(nsyms);
if (symbol_assoc == 0) no_space();
- v = (bucket **) MALLOC(nsyms*sizeof(bucket *));
+ v = malloc(nsyms*sizeof(bucket *));
if (v == 0) no_space();
v[0] = 0;
@@ -1808,7 +1808,7 @@ pack_symbols(void)
symbol_assoc[k] = v[i]->assoc;
}
- FREE(v);
+ free(v);
}
@@ -1818,15 +1818,15 @@ pack_grammar(void)
int i, j;
int assoc, preced;
- ritem = (short *) MALLOC(nitems*sizeof(short));
+ ritem = malloc(nitems*sizeof(short));
if (ritem == 0) no_space();
- rlhs = (short *) MALLOC(nrules*sizeof(short));
+ rlhs = malloc(nrules*sizeof(short));
if (rlhs == 0) no_space();
- rrhs = (short *) MALLOC((nrules+1)*sizeof(short));
+ rrhs = malloc((nrules+1)*sizeof(short));
if (rrhs == 0) no_space();
- rprec = (short *) REALLOC(rprec, nrules*sizeof(short));
+ rprec = realloc(rprec, nrules*sizeof(short));
if (rprec == 0) no_space();
- rassoc = REALLOC(rassoc, nrules);
+ rassoc = realloc(rassoc, nrules);
if (rassoc == 0) no_space();
ritem[0] = -1;
@@ -1867,8 +1867,8 @@ pack_grammar(void)
}
rrhs[i] = j;
- FREE(plhs);
- FREE(pitem);
+ free(plhs);
+ free(pitem);
}
diff --git a/usr.bin/yacc/skeleton.c b/usr.bin/yacc/skeleton.c
index 4ea78c72a2ef..38f063b42077 100644
--- a/usr.bin/yacc/skeleton.c
+++ b/usr.bin/yacc/skeleton.c
@@ -157,14 +157,14 @@ const char *body[] =
" else if ((newsize *= 2) > YYMAXDEPTH)",
" newsize = YYMAXDEPTH;",
" i = yyssp - yyss;",
- " newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :",
- " (short *)malloc(newsize * sizeof *newss);",
+ " newss = yyss ? realloc(yyss, newsize * sizeof *newss) :",
+ " malloc(newsize * sizeof *newss);",
" if (newss == NULL)",
" return -1;",
" yyss = newss;",
" yyssp = newss + i;",
- " newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :",
- " (YYSTYPE *)malloc(newsize * sizeof *newvs);",
+ " newvs = yyvs ? realloc(yyvs, newsize * sizeof *newvs) :",
+ " malloc(newsize * sizeof *newvs);",
" if (newvs == NULL)",
" return -1;",
" yyvs = newvs;",
diff --git a/usr.bin/yacc/symtab.c b/usr.bin/yacc/symtab.c
index a914527ac659..05a8d660e5b7 100644
--- a/usr.bin/yacc/symtab.c
+++ b/usr.bin/yacc/symtab.c
@@ -81,11 +81,11 @@ make_bucket(const char *name)
bucket *bp;
assert(name);
- bp = (bucket *) MALLOC(sizeof(bucket));
+ bp = malloc(sizeof(bucket));
if (bp == 0) no_space();
bp->link = 0;
bp->next = 0;
- bp->name = MALLOC(strlen(name) + 1);
+ bp->name = malloc(strlen(name) + 1);
if (bp->name == 0) no_space();
bp->tag = 0;
bp->value = UNDEFINED;
@@ -130,7 +130,7 @@ create_symbol_table(void)
int i;
bucket *bp;
- symbol_table = (bucket **) MALLOC(TABLE_SIZE*sizeof(bucket *));
+ symbol_table = malloc(TABLE_SIZE*sizeof(bucket *));
if (symbol_table == 0) no_space();
for (i = 0; i < TABLE_SIZE; i++)
symbol_table[i] = 0;
@@ -148,7 +148,7 @@ create_symbol_table(void)
void
free_symbol_table(void)
{
- FREE(symbol_table);
+ free(symbol_table);
symbol_table = 0;
}
@@ -161,6 +161,6 @@ free_symbols(void)
for (p = first_symbol; p; p = q)
{
q = p->next;
- FREE(p);
+ free(p);
}
}
diff --git a/usr.bin/yacc/verbose.c b/usr.bin/yacc/verbose.c
index a80e6e0553de..3eeae4004726 100644
--- a/usr.bin/yacc/verbose.c
+++ b/usr.bin/yacc/verbose.c
@@ -66,12 +66,12 @@ verbose(void)
if (!vflag) return;
- null_rules = (short *) MALLOC(nrules*sizeof(short));
+ null_rules = malloc(nrules*sizeof(short));
if (null_rules == 0) no_space();
fprintf(verbose_file, "\f\n");
for (i = 0; i < nstates; i++)
print_state(i);
- FREE(null_rules);
+ free(null_rules);
if (nunused)
log_unused();