[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5585-g81eb4297
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5585-g81eb4297 |
Date: |
Sun, 15 Dec 2024 07:51:36 -0500 (EST) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-5.3-stable has been updated
via 81eb42976124a83fd3ee88bdf5dabe8fa75bd852 (commit)
from dae1e1586105413906941c133fb525e03dcd707c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=81eb42976124a83fd3ee88bdf5dabe8fa75bd852
commit 81eb42976124a83fd3ee88bdf5dabe8fa75bd852
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sun Dec 15 14:50:58 2024 +0200
Simplify emalloc/erealloc/ezalloc macros.
diff --git a/ChangeLog b/ChangeLog
index fa54e19f..69416e2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-12-15 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (emalloc, erealloc, ezalloc): Move to using __func__
+ instead of requiring the function name as a string in the
+ source code.
+ * All source files: Updated all uses.
+
2024-12-11 Arnold D. Robbins <arnold@skeeve.com>
* awk.h: Remove accidentally left-over Tandem bits.
diff --git a/array.c b/array.c
index 2de07b8d..88d3b001 100644
--- a/array.c
+++ b/array.c
@@ -210,17 +210,17 @@ make_aname(const NODE *symbol)
slen = strlen(symbol->vname); /* subscript in parent array */
if (alen + slen + 4 > max_alen) { /*
sizeof("[\"\"]") = 4 */
max_alen = alen + slen + 4 + SLEN;
- erealloc(aname, char *, (max_alen + 1) * sizeof(char
*), "make_aname");
+ erealloc(aname, char *, (max_alen + 1) * sizeof(char
*));
}
alen += sprintf(aname + alen, "[\"%s\"]", symbol->vname);
} else {
alen = strlen(symbol->vname);
if (aname == NULL) {
max_alen = alen + SLEN;
- emalloc(aname, char *, (max_alen + 1) * sizeof(char *),
"make_aname");
+ emalloc(aname, char *, (max_alen + 1) * sizeof(char *));
} else if (alen > max_alen) {
max_alen = alen + SLEN;
- erealloc(aname, char *, (max_alen + 1) * sizeof(char
*), "make_aname");
+ erealloc(aname, char *, (max_alen + 1) * sizeof(char
*));
}
memcpy(aname, symbol->vname, alen + 1);
}
@@ -282,10 +282,10 @@ array_vname(const NODE *symbol)
/* (Re)allocate memory: */
if (message == NULL) {
- emalloc(message, char *, len, "array_vname");
+ emalloc(message, char *, len);
msglen = len;
} else if (len > msglen) {
- erealloc(message, char *, len, "array_vname");
+ erealloc(message, char *, len);
msglen = len;
} /* else
current buffer can hold new name */
@@ -412,7 +412,7 @@ concat_exp(int nargs, bool do_subsep)
}
len += (nargs - 1) * subseplen;
- emalloc(str, char *, len + 1, "concat_exp");
+ emalloc(str, char *, len + 1);
r = args_array[nargs];
memcpy(str, r->stptr, r->stlen);
@@ -1455,7 +1455,7 @@ assoc_list(NODE *symbol, const char *sort_str,
sort_context_t sort_ctxt)
/* give back extra memory */
- erealloc(list, NODE **, num_elems * sizeof(NODE *),
"assoc_list");
+ erealloc(list, NODE **, num_elems * sizeof(NODE *));
}
}
@@ -1477,7 +1477,7 @@ new_array_element(void)
NODE *n = make_number(0.0);
char *sp;
- emalloc(sp, char *, 2, "new_array_element");
+ emalloc(sp, char *, 2);
sp[0] = sp[1] = '\0';
n->stptr = sp;
diff --git a/awk.h b/awk.h
index 5ad3b19d..9bfbd1ee 100644
--- a/awk.h
+++ b/awk.h
@@ -1379,13 +1379,13 @@ extern void r_freeblock(void *, int id);
__FILE__, __LINE__, __VA_ARGS__)
#ifdef USE_REAL_MALLOC
-#define emalloc(var,ty,x,str) (void) (var = (ty) malloc((size_t)(x)))
-#define ezalloc(var,ty,x,str) (void) (var = (ty) calloc((size_t)(x),
1))
-#define erealloc(var,ty,x,str) (void) (var = (ty) realloc((void *)
var, (size_t)(x)))
+#define emalloc(var,ty,x) (void) (var = (ty) malloc((size_t)(x)))
+#define ezalloc(var,ty,x) (void) (var = (ty) calloc((size_t)(x),
1))
+#define erealloc(var,ty,x) (void) (var = (ty) realloc((void *)
var, (size_t)(x)))
#else
-#define emalloc(var,ty,x,str) (void) (var = (ty)
emalloc_real((size_t)(x), str, #var, __FILE__, __LINE__))
-#define ezalloc(var,ty,x,str) (void) (var = (ty)
ezalloc_real((size_t)(x), str, #var, __FILE__, __LINE__))
-#define erealloc(var,ty,x,str) (void) (var = (ty) erealloc_real((void
*) var, (size_t)(x), str, #var, __FILE__, __LINE__))
+#define emalloc(var,ty,x) (void) (var = (ty)
emalloc_real((size_t)(x), __func__, #var, __FILE__, __LINE__))
+#define ezalloc(var,ty,x) (void) (var = (ty)
ezalloc_real((size_t)(x), __func__, #var, __FILE__, __LINE__))
+#define erealloc(var,ty,x) (void) (var = (ty) erealloc_real((void
*) var, (size_t)(x), __func__, #var, __FILE__, __LINE__))
#endif
#define efree(p) free(p)
diff --git a/awkgram.c b/awkgram.c
index 6fd16c43..3539d3ad 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -2549,10 +2549,10 @@ yyreduce:
}
if (case_values == NULL)
- emalloc(case_values, const char
**, sizeof(char *) * maxcount, "statement");
+ emalloc(case_values, const char
**, sizeof(char *) * maxcount);
else if (case_count >= maxcount) {
maxcount += 128;
- erealloc(case_values, const
char **, sizeof(char*) * maxcount, "statement");
+ erealloc(case_values, const
char **, sizeof(char*) * maxcount);
}
case_values[case_count++] = caseval;
} else {
@@ -3918,7 +3918,7 @@ regular_print:
n1 = force_string(n1);
n2 = force_string(n2);
nlen = n1->stlen + n2->stlen;
- erealloc(n1->stptr, char *, nlen + 1, "constant fold");
+ erealloc(n1->stptr, char *, nlen + 1);
memcpy(n1->stptr + n1->stlen, n2->stptr, n2->stlen);
n1->stlen = nlen;
n1->stptr[nlen] = '\0';
@@ -5108,7 +5108,7 @@ yyerror(const char *m, ...)
count = strlen(mesg) + 1;
if (lexptr != NULL)
count += (lexeme - thisline) + 2;
- ezalloc(buf, char *, count+1, "yyerror");
+ ezalloc(buf, char *, count+1);
bp = buf;
@@ -5319,9 +5319,9 @@ parse_program(INSTRUCTION **pcode, bool from_eval)
errcount++;
if (args_array == NULL)
- emalloc(args_array, NODE **, (max_args + 2) * sizeof(NODE *),
"parse_program");
+ emalloc(args_array, NODE **, (max_args + 2) * sizeof(NODE *));
else
- erealloc(args_array, NODE **, (max_args + 2) * sizeof(NODE *),
"parse_program");
+ erealloc(args_array, NODE **, (max_args + 2) * sizeof(NODE *));
return (ret || errcount);
}
@@ -5342,7 +5342,7 @@ do_add_srcfile(enum srctype stype, char *src, char *path,
SRCFILE *thisfile)
{
SRCFILE *s;
- ezalloc(s, SRCFILE *, sizeof(SRCFILE), "do_add_srcfile");
+ ezalloc(s, SRCFILE *, sizeof(SRCFILE));
s->src = estrdup(src, strlen(src));
s->fullpath = path;
s->stype = stype;
@@ -5664,7 +5664,7 @@ get_src_buf()
break;
}
savelen = lexptr - scan;
- emalloc(buf, char *, savelen + 1, "get_src_buf");
+ emalloc(buf, char *, savelen + 1);
memcpy(buf, scan, savelen);
thisline = buf;
lexptr = buf + savelen;
@@ -5712,7 +5712,7 @@ get_src_buf()
#undef A_DECENT_BUFFER_SIZE
sourcefile->bufsize = l;
newfile = true;
- emalloc(sourcefile->buf, char *, sourcefile->bufsize,
"get_src_buf");
+ emalloc(sourcefile->buf, char *, sourcefile->bufsize);
memset(sourcefile->buf, '\0', sourcefile->bufsize); // keep
valgrind happy
lexptr = lexptr_begin = lexeme = sourcefile->buf;
savelen = 0;
@@ -5742,7 +5742,7 @@ get_src_buf()
if (savelen > sourcefile->bufsize / 2) { /* long line
or token */
sourcefile->bufsize *= 2;
- erealloc(sourcefile->buf, char *,
sourcefile->bufsize, "get_src_buf");
+ erealloc(sourcefile->buf, char *,
sourcefile->bufsize);
scan = sourcefile->buf + (scan - lexptr_begin);
lexptr_begin = sourcefile->buf;
}
@@ -5794,11 +5794,11 @@ tokexpand()
if (tokstart != NULL) {
tokoffset = tok - tokstart;
toksize *= 2;
- erealloc(tokstart, char *, toksize, "tokexpand");
+ erealloc(tokstart, char *, toksize);
tok = tokstart + tokoffset;
} else {
toksize = 60;
- emalloc(tokstart, char *, toksize, "tokexpand");
+ emalloc(tokstart, char *, toksize);
tok = tokstart;
}
tokend = tokstart + toksize;
@@ -6937,7 +6937,7 @@ retry:
case LEX_EVAL:
if (in_main_context())
goto out;
- emalloc(tokkey, char *, tok - tokstart + 1, "yylex");
+ emalloc(tokkey, char *, tok - tokstart + 1);
tokkey[0] = '@';
memcpy(tokkey + 1, tokstart, tok - tokstart);
yylval = GET_INSTRUCTION(Op_token);
@@ -7612,7 +7612,7 @@ check_params(char *fname, int pcount, INSTRUCTION *list)
assert(pcount > 0);
- emalloc(pnames, char **, pcount * sizeof(char *), "check_params");
+ emalloc(pnames, char **, pcount * sizeof(char *));
for (i = 0, p = list->nexti; p != NULL; i++, p = np) {
np = p->nexti;
@@ -7681,8 +7681,8 @@ func_use(const char *name, enum defref how)
/* not in the table, fall through to allocate a new one */
- ezalloc(fp, struct fdesc *, sizeof(struct fdesc), "func_use");
- emalloc(fp->name, char *, len + 1, "func_use");
+ ezalloc(fp, struct fdesc *, sizeof(struct fdesc));
+ emalloc(fp->name, char *, len + 1);
strcpy(fp->name, name);
fp->next = ftable[ind];
ftable[ind] = fp;
@@ -9158,7 +9158,7 @@ set_profile_text(NODE *n, const char *str, size_t len)
if (do_pretty_print) {
// two extra bytes: one for NUL termination, and another in
// case we need to add a leading minus sign in add_sign_to_num
- emalloc(n->stptr, char *, len + 2, "set_profile_text");
+ emalloc(n->stptr, char *, len + 2);
memcpy(n->stptr, str, len);
n->stptr[len] = '\0';
n->stlen = len;
@@ -9202,7 +9202,7 @@ merge_comments(INSTRUCTION *c1, INSTRUCTION *c2)
}
char *buffer;
- emalloc(buffer, char *, total + 1, "merge_comments");
+ emalloc(buffer, char *, total + 1);
strcpy(buffer, c1->memory->stptr);
if (c1->comment != NULL) {
@@ -9460,7 +9460,7 @@ qualify_name(const char *name, size_t len)
size_t length = strlen(current_namespace) + 2 + len + 1;
char *buf;
- emalloc(buf, char *, length, "qualify_name");
+ emalloc(buf, char *, length);
sprintf(buf, "%s::%s", current_namespace, name);
return buf;
diff --git a/awkgram.y b/awkgram.y
index aab9a41b..3388e699 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -697,10 +697,10 @@ statement
}
if (case_values == NULL)
- emalloc(case_values, const char
**, sizeof(char *) * maxcount, "statement");
+ emalloc(case_values, const char
**, sizeof(char *) * maxcount);
else if (case_count >= maxcount) {
maxcount += 128;
- erealloc(case_values, const
char **, sizeof(char*) * maxcount, "statement");
+ erealloc(case_values, const
char **, sizeof(char*) * maxcount);
}
case_values[case_count++] = caseval;
} else {
@@ -1773,7 +1773,7 @@ common_exp
n1 = force_string(n1);
n2 = force_string(n2);
nlen = n1->stlen + n2->stlen;
- erealloc(n1->stptr, char *, nlen + 1, "constant fold");
+ erealloc(n1->stptr, char *, nlen + 1);
memcpy(n1->stptr + n1->stlen, n2->stptr, n2->stlen);
n1->stlen = nlen;
n1->stptr[nlen] = '\0';
@@ -2606,7 +2606,7 @@ yyerror(const char *m, ...)
count = strlen(mesg) + 1;
if (lexptr != NULL)
count += (lexeme - thisline) + 2;
- ezalloc(buf, char *, count+1, "yyerror");
+ ezalloc(buf, char *, count+1);
bp = buf;
@@ -2817,9 +2817,9 @@ parse_program(INSTRUCTION **pcode, bool from_eval)
errcount++;
if (args_array == NULL)
- emalloc(args_array, NODE **, (max_args + 2) * sizeof(NODE *),
"parse_program");
+ emalloc(args_array, NODE **, (max_args + 2) * sizeof(NODE *));
else
- erealloc(args_array, NODE **, (max_args + 2) * sizeof(NODE *),
"parse_program");
+ erealloc(args_array, NODE **, (max_args + 2) * sizeof(NODE *));
return (ret || errcount);
}
@@ -2840,7 +2840,7 @@ do_add_srcfile(enum srctype stype, char *src, char *path,
SRCFILE *thisfile)
{
SRCFILE *s;
- ezalloc(s, SRCFILE *, sizeof(SRCFILE), "do_add_srcfile");
+ ezalloc(s, SRCFILE *, sizeof(SRCFILE));
s->src = estrdup(src, strlen(src));
s->fullpath = path;
s->stype = stype;
@@ -3162,7 +3162,7 @@ get_src_buf()
break;
}
savelen = lexptr - scan;
- emalloc(buf, char *, savelen + 1, "get_src_buf");
+ emalloc(buf, char *, savelen + 1);
memcpy(buf, scan, savelen);
thisline = buf;
lexptr = buf + savelen;
@@ -3210,7 +3210,7 @@ get_src_buf()
#undef A_DECENT_BUFFER_SIZE
sourcefile->bufsize = l;
newfile = true;
- emalloc(sourcefile->buf, char *, sourcefile->bufsize,
"get_src_buf");
+ emalloc(sourcefile->buf, char *, sourcefile->bufsize);
memset(sourcefile->buf, '\0', sourcefile->bufsize); // keep
valgrind happy
lexptr = lexptr_begin = lexeme = sourcefile->buf;
savelen = 0;
@@ -3240,7 +3240,7 @@ get_src_buf()
if (savelen > sourcefile->bufsize / 2) { /* long line
or token */
sourcefile->bufsize *= 2;
- erealloc(sourcefile->buf, char *,
sourcefile->bufsize, "get_src_buf");
+ erealloc(sourcefile->buf, char *,
sourcefile->bufsize);
scan = sourcefile->buf + (scan - lexptr_begin);
lexptr_begin = sourcefile->buf;
}
@@ -3292,11 +3292,11 @@ tokexpand()
if (tokstart != NULL) {
tokoffset = tok - tokstart;
toksize *= 2;
- erealloc(tokstart, char *, toksize, "tokexpand");
+ erealloc(tokstart, char *, toksize);
tok = tokstart + tokoffset;
} else {
toksize = 60;
- emalloc(tokstart, char *, toksize, "tokexpand");
+ emalloc(tokstart, char *, toksize);
tok = tokstart;
}
tokend = tokstart + toksize;
@@ -4435,7 +4435,7 @@ retry:
case LEX_EVAL:
if (in_main_context())
goto out;
- emalloc(tokkey, char *, tok - tokstart + 1, "yylex");
+ emalloc(tokkey, char *, tok - tokstart + 1);
tokkey[0] = '@';
memcpy(tokkey + 1, tokstart, tok - tokstart);
yylval = GET_INSTRUCTION(Op_token);
@@ -5110,7 +5110,7 @@ check_params(char *fname, int pcount, INSTRUCTION *list)
assert(pcount > 0);
- emalloc(pnames, char **, pcount * sizeof(char *), "check_params");
+ emalloc(pnames, char **, pcount * sizeof(char *));
for (i = 0, p = list->nexti; p != NULL; i++, p = np) {
np = p->nexti;
@@ -5179,8 +5179,8 @@ func_use(const char *name, enum defref how)
/* not in the table, fall through to allocate a new one */
- ezalloc(fp, struct fdesc *, sizeof(struct fdesc), "func_use");
- emalloc(fp->name, char *, len + 1, "func_use");
+ ezalloc(fp, struct fdesc *, sizeof(struct fdesc));
+ emalloc(fp->name, char *, len + 1);
strcpy(fp->name, name);
fp->next = ftable[ind];
ftable[ind] = fp;
@@ -6656,7 +6656,7 @@ set_profile_text(NODE *n, const char *str, size_t len)
if (do_pretty_print) {
// two extra bytes: one for NUL termination, and another in
// case we need to add a leading minus sign in add_sign_to_num
- emalloc(n->stptr, char *, len + 2, "set_profile_text");
+ emalloc(n->stptr, char *, len + 2);
memcpy(n->stptr, str, len);
n->stptr[len] = '\0';
n->stlen = len;
@@ -6700,7 +6700,7 @@ merge_comments(INSTRUCTION *c1, INSTRUCTION *c2)
}
char *buffer;
- emalloc(buffer, char *, total + 1, "merge_comments");
+ emalloc(buffer, char *, total + 1);
strcpy(buffer, c1->memory->stptr);
if (c1->comment != NULL) {
@@ -6958,7 +6958,7 @@ qualify_name(const char *name, size_t len)
size_t length = strlen(current_namespace) + 2 + len + 1;
char *buf;
- emalloc(buf, char *, length, "qualify_name");
+ emalloc(buf, char *, length);
sprintf(buf, "%s::%s", current_namespace, name);
return buf;
diff --git a/builtin.c b/builtin.c
index 3c4c8f91..f03ba701 100644
--- a/builtin.c
+++ b/builtin.c
@@ -810,7 +810,7 @@ do_substr(int nargs)
* way to do things.
*/
memset(& mbs, 0, sizeof(mbs));
- emalloc(substr, char *, (length * gawk_mb_cur_max) + 1,
"do_substr");
+ emalloc(substr, char *, (length * gawk_mb_cur_max) + 1);
wp = t1->wstptr + indx;
for (cp = substr; length > 0; length--) {
result = wcrtomb(cp, *wp, & mbs);
@@ -951,9 +951,9 @@ do_strftime(int nargs)
break;
bufsize *= 2;
if (bufp == buf)
- emalloc(bufp, char *, bufsize, "do_strftime");
+ emalloc(bufp, char *, bufsize);
else
- erealloc(bufp, char *, bufsize, "do_strftime");
+ erealloc(bufp, char *, bufsize);
}
ret = make_string(bufp, buflen);
if (bufp != buf)
@@ -1646,9 +1646,9 @@ do_match(int nargs)
amt = ilen + subseplen +
strlen("length") + 1;
if (oldamt == 0) {
- emalloc(buf, char *, amt,
"do_match");
+ emalloc(buf, char *, amt);
} else if (amt > oldamt) {
- erealloc(buf, char *, amt,
"do_match");
+ erealloc(buf, char *, amt);
}
oldamt = amt;
memcpy(buf, buff, ilen);
@@ -1901,7 +1901,7 @@ do_sub(int nargs, unsigned int flags)
* for example.
*/
if (gawk_mb_cur_max > 1 && repllen > 0) {
- emalloc(mb_indices, char *, repllen * sizeof(char), "do_sub");
+ emalloc(mb_indices, char *, repllen * sizeof(char));
index_multibyte_buffer(repl, mb_indices, repllen);
}
@@ -1954,7 +1954,7 @@ do_sub(int nargs, unsigned int flags)
/* guesstimate how much room to allocate; +1 forces > 0 */
buflen = textlen + (ampersands + 1) * repllen + 1;
- emalloc(buf, char *, buflen + 1, "do_sub");
+ emalloc(buf, char *, buflen + 1);
buf[buflen] = '\0';
bp = buf;
@@ -1981,7 +1981,7 @@ do_sub(int nargs, unsigned int flags)
sofar = bp - buf;
while (buflen < (sofar + len + 1)) {
buflen *= 2;
- erealloc(buf, char *, buflen, "sub_common");
+ erealloc(buf, char *, buflen);
bp = buf + sofar;
}
for (scan = text; scan < matchstart; scan++)
@@ -2114,7 +2114,7 @@ do_sub(int nargs, unsigned int flags)
sofar = bp - buf;
if (buflen < (sofar + textlen + 1)) {
buflen = sofar + textlen + 1;
- erealloc(buf, char *, buflen, "do_sub");
+ erealloc(buf, char *, buflen);
bp = buf + sofar;
}
/*
@@ -3146,7 +3146,7 @@ do_typeof(int nargs)
#define SETVAL(X, V) { \
size_t l = nl + sizeof(#X); \
- emalloc(p, char *, l+1, "do_typeof"); \
+ emalloc(p, char *, l+1); \
sprintf(p, "%s_" #X, nextfree[i].name); \
assoc_set(dbg, make_str_node(p, l, ALREADY_MALLOCED),
make_number((AWKNUM) (V))); \
}
diff --git a/cint_array.c b/cint_array.c
index 27298fba..5f0f0b6e 100644
--- a/cint_array.c
+++ b/cint_array.c
@@ -246,7 +246,7 @@ cint_lookup(NODE *symbol, NODE *subs)
assert(symbol->table_size == 0);
/* nodes[0] .. nodes[NHAT- 1] not used */
- ezalloc(symbol->nodes, NODE **, INT32_BIT * sizeof(NODE *),
"cint_lookup");
+ ezalloc(symbol->nodes, NODE **, INT32_BIT * sizeof(NODE *));
}
symbol->table_size++; /* one more element in array */
@@ -404,7 +404,7 @@ cint_copy(NODE *symbol, NODE *newsymb)
assert(symbol->nodes != NULL);
/* allocate new table */
- ezalloc(new, NODE **, INT32_BIT * sizeof(NODE *), "cint_copy");
+ ezalloc(new, NODE **, INT32_BIT * sizeof(NODE *));
old = symbol->nodes;
for (i = NHAT; i < INT32_BIT; i++) {
@@ -464,10 +464,10 @@ cint_list(NODE *symbol, NODE *t)
t->flags = (unsigned int) assoc_kind;
if (num_elems == 1 || num_elems == xn->table_size)
return list;
- erealloc(list, NODE **, list_size * sizeof(NODE *),
"cint_list");
+ erealloc(list, NODE **, list_size * sizeof(NODE *));
k = elem_size * xn->table_size;
} else
- emalloc(list, NODE **, list_size * sizeof(NODE *), "cint_list");
+ emalloc(list, NODE **, list_size * sizeof(NODE *));
if ((assoc_kind & AINUM) == 0) {
/* not sorting by "index num" */
@@ -770,7 +770,7 @@ tree_lookup(NODE *symbol, NODE *tree, long k, int m, long
base)
actual_size /= 2;
tree->flags |= HALFHAT;
}
- ezalloc(table, NODE **, actual_size * sizeof(NODE *),
"tree_lookup");
+ ezalloc(table, NODE **, actual_size * sizeof(NODE *));
tree->nodes = table;
} else
size = tree->array_size;
@@ -943,7 +943,7 @@ tree_copy(NODE *newsymb, NODE *tree, NODE *newtree)
if ((tree->flags & HALFHAT) != 0)
hsize /= 2;
- ezalloc(new, NODE **, hsize * sizeof(NODE *), "tree_copy");
+ ezalloc(new, NODE **, hsize * sizeof(NODE *));
newtree->nodes = new;
newtree->array_base = tree->array_base;
newtree->array_size = tree->array_size;
@@ -1061,7 +1061,7 @@ leaf_lookup(NODE *symbol, NODE *array, long k, long size,
long base)
array->table_size = 0; /* sanity */
array->array_size = size;
array->array_base = base;
- ezalloc(array->nodes, NODE **, size * sizeof(NODE *),
"leaf_lookup");
+ ezalloc(array->nodes, NODE **, size * sizeof(NODE *));
symbol->array_capacity += size;
}
@@ -1140,7 +1140,7 @@ leaf_copy(NODE *newsymb, NODE *array, NODE *newarray)
long size, i;
size = array->array_size;
- ezalloc(new, NODE **, size * sizeof(NODE *), "leaf_copy");
+ ezalloc(new, NODE **, size * sizeof(NODE *));
newarray->nodes = new;
newarray->array_size = size;
newarray->array_base = array->array_base;
diff --git a/command.c b/command.c
index b468b68a..80e50d97 100644
--- a/command.c
+++ b/command.c
@@ -2490,7 +2490,7 @@ append_statement(CMDARG *stmt_list, char *stmt)
len += strlen(a->a_string) + 1; /* 1 for ',' */
len += EVALSIZE;
- emalloc(s, char *, (len + 1) * sizeof(char),
"append_statement");
+ emalloc(s, char *, (len + 1) * sizeof(char));
arg = mk_cmdarg(D_string);
arg->a_string = s;
arg->a_count = len; /* kludge */
@@ -2517,7 +2517,7 @@ append_statement(CMDARG *stmt_list, char *stmt)
ssize = stmt_list->a_count;
if (len > ssize - slen) {
ssize = slen + len + EVALSIZE;
- erealloc(s, char *, (ssize + 1) * sizeof(char),
"append_statement");
+ erealloc(s, char *, (ssize + 1) * sizeof(char));
stmt_list->a_string = s;
stmt_list->a_count = ssize;
}
@@ -2529,7 +2529,7 @@ append_statement(CMDARG *stmt_list, char *stmt)
}
if (stmt == end_EVAL)
- erealloc(stmt_list->a_string, char *, slen + 1,
"append_statement");
+ erealloc(stmt_list->a_string, char *, slen + 1);
return stmt_list;
#undef EVALSIZE
@@ -2682,7 +2682,7 @@ static CMDARG *
mk_cmdarg(enum argtype type)
{
CMDARG *arg;
- ezalloc(arg, CMDARG *, sizeof(CMDARG), "mk_cmdarg");
+ ezalloc(arg, CMDARG *, sizeof(CMDARG));
arg->type = type;
return arg;
}
@@ -2901,7 +2901,7 @@ again:
bool esc_seen = false;
toklen = lexend - lexptr;
- emalloc(str, char *, toklen + 1, "yylex");
+ emalloc(str, char *, toklen + 1);
p = str;
while ((c = *++lexptr) != '"') {
@@ -3101,7 +3101,7 @@ concat_args(CMDARG *arg, int count)
return dupnode(n);
}
- emalloc(tmp, NODE **, count * sizeof(NODE *), "concat_args");
+ emalloc(tmp, NODE **, count * sizeof(NODE *));
subseplen = SUBSEP_node->var_value->stlen;
subsep = SUBSEP_node->var_value->stptr;
len = -subseplen;
@@ -3113,7 +3113,7 @@ concat_args(CMDARG *arg, int count)
arg = arg->next;
}
- emalloc(str, char *, len + 1, "concat_args");
+ emalloc(str, char *, len + 1);
n = tmp[0];
memcpy(str, n->stptr, n->stlen);
p = str + n->stlen;
diff --git a/command.y b/command.y
index 8135ddb5..86a4704d 100644
--- a/command.y
+++ b/command.y
@@ -767,7 +767,7 @@ append_statement(CMDARG *stmt_list, char *stmt)
len += strlen(a->a_string) + 1; /* 1 for ',' */
len += EVALSIZE;
- emalloc(s, char *, (len + 1) * sizeof(char),
"append_statement");
+ emalloc(s, char *, (len + 1) * sizeof(char));
arg = mk_cmdarg(D_string);
arg->a_string = s;
arg->a_count = len; /* kludge */
@@ -794,7 +794,7 @@ append_statement(CMDARG *stmt_list, char *stmt)
ssize = stmt_list->a_count;
if (len > ssize - slen) {
ssize = slen + len + EVALSIZE;
- erealloc(s, char *, (ssize + 1) * sizeof(char),
"append_statement");
+ erealloc(s, char *, (ssize + 1) * sizeof(char));
stmt_list->a_string = s;
stmt_list->a_count = ssize;
}
@@ -806,7 +806,7 @@ append_statement(CMDARG *stmt_list, char *stmt)
}
if (stmt == end_EVAL)
- erealloc(stmt_list->a_string, char *, slen + 1,
"append_statement");
+ erealloc(stmt_list->a_string, char *, slen + 1);
return stmt_list;
#undef EVALSIZE
@@ -959,7 +959,7 @@ static CMDARG *
mk_cmdarg(enum argtype type)
{
CMDARG *arg;
- ezalloc(arg, CMDARG *, sizeof(CMDARG), "mk_cmdarg");
+ ezalloc(arg, CMDARG *, sizeof(CMDARG));
arg->type = type;
return arg;
}
@@ -1178,7 +1178,7 @@ again:
bool esc_seen = false;
toklen = lexend - lexptr;
- emalloc(str, char *, toklen + 1, "yylex");
+ emalloc(str, char *, toklen + 1);
p = str;
while ((c = *++lexptr) != '"') {
@@ -1378,7 +1378,7 @@ concat_args(CMDARG *arg, int count)
return dupnode(n);
}
- emalloc(tmp, NODE **, count * sizeof(NODE *), "concat_args");
+ emalloc(tmp, NODE **, count * sizeof(NODE *));
subseplen = SUBSEP_node->var_value->stlen;
subsep = SUBSEP_node->var_value->stptr;
len = -subseplen;
@@ -1390,7 +1390,7 @@ concat_args(CMDARG *arg, int count)
arg = arg->next;
}
- emalloc(str, char *, len + 1, "concat_args");
+ emalloc(str, char *, len + 1);
n = tmp[0];
memcpy(str, n->stptr, n->stlen);
p = str + n->stlen;
diff --git a/debug.c b/debug.c
index 9feb4bad..ef13196d 100644
--- a/debug.c
+++ b/debug.c
@@ -387,7 +387,7 @@ g_readline(const char *prompt)
if (input_from_tty && prompt && *prompt)
fprintf(out_fp, "%s", prompt);
- emalloc(line, char *, line_size + 1, "g_readline");
+ emalloc(line, char *, line_size + 1);
p = line;
end = line + line_size;
while ((n = read(input_fd, buf, 1)) > 0) {
@@ -397,7 +397,7 @@ g_readline(const char *prompt)
break;
}
if (p == end) {
- erealloc(line, char *, 2 * line_size + 1, "g_readline");
+ erealloc(line, char *, 2 * line_size + 1);
p = line + line_size;
line_size *= 2;
end = line + line_size;
@@ -440,9 +440,9 @@ find_lines(SRCFILE *s)
int numlines = 0;
char lastchar = '\0';
- emalloc(buf, char *, s->bufsize, "find_lines");
+ emalloc(buf, char *, s->bufsize);
pos_size = s->srclines;
- emalloc(s->line_offset, int *, (pos_size + 2) * sizeof(int),
"find_lines");
+ emalloc(s->line_offset, int *, (pos_size + 2) * sizeof(int));
pos = s->line_offset;
pos[0] = 0;
@@ -453,7 +453,7 @@ find_lines(SRCFILE *s)
while (p < end) {
if (*p++ == '\n') {
if (++numlines > pos_size) {
- erealloc(s->line_offset, int *, (2 *
pos_size + 2) * sizeof(int), "find_lines");
+ erealloc(s->line_offset, int *, (2 *
pos_size + 2) * sizeof(int));
pos = s->line_offset + pos_size;
pos_size *= 2;
}
@@ -586,10 +586,10 @@ print_lines(char *src, int start_line, int nlines)
}
if (linebuf == NULL) {
- emalloc(linebuf, char *, s->maxlen + 20, "print_lines"); /* 19
for line # */
+ emalloc(linebuf, char *, s->maxlen + 20); /* 19 for line # */
linebuf_len = s->maxlen;
} else if (linebuf_len < s->maxlen) {
- erealloc(linebuf, char *, s->maxlen + 20, "print_lines");
+ erealloc(linebuf, char *, s->maxlen + 20);
linebuf_len = s->maxlen;
}
@@ -1116,7 +1116,7 @@ print_array(volatile NODE *arr, char *arr_name)
#define INITIAL_NAME_COUNT 10
if (names == NULL) {
- emalloc(names, const char **, INITIAL_NAME_COUNT * sizeof(char
*), "print_array");
+ emalloc(names, const char **, INITIAL_NAME_COUNT * sizeof(char
*));
memset(names, 0, INITIAL_NAME_COUNT * sizeof(char *));
num_names = INITIAL_NAME_COUNT;
}
@@ -1136,7 +1136,7 @@ print_array(volatile NODE *arr, char *arr_name)
// push name onto stack
if (cur_name >= num_names) {
num_names *= 2;
- erealloc(names, const char **, num_names * sizeof(char
*), "print_array");
+ erealloc(names, const char **, num_names * sizeof(char
*));
}
names[cur_name++] = arr_name;
@@ -1440,7 +1440,7 @@ add_item(struct list_item *list, int type, NODE *symbol,
char *pname)
{
struct list_item *d;
- ezalloc(d, struct list_item *, sizeof(struct list_item), "add_item");
+ ezalloc(d, struct list_item *, sizeof(struct list_item));
d->commands.next = d->commands.prev = &d->commands;
d->number = ++list->number;
@@ -1503,7 +1503,7 @@ do_add_item(struct list_item *list, CMDARG *arg)
int i;
assert(count > 0);
- emalloc(subs, NODE **, count * sizeof(NODE *),
"do_add_item");
+ emalloc(subs, NODE **, count * sizeof(NODE *));
for (i = 0; i < count; i++) {
arg = arg->next;
subs[i] = dupnode(arg->a_node);
@@ -2175,7 +2175,7 @@ mk_breakpoint(char *src, int srcline)
BREAKPOINT *b;
bp = bcalloc(Op_breakpoint, 1, srcline);
- emalloc(b, BREAKPOINT *, sizeof(BREAKPOINT), "mk_breakpoint");
+ emalloc(b, BREAKPOINT *, sizeof(BREAKPOINT));
memset(&b->cndn, 0, sizeof(struct condition));
b->commands.next = b->commands.prev = &b->commands;
b->silent = false;
@@ -4405,10 +4405,10 @@ gprintf(FILE *fp, const char *format, ...)
#define GPRINTF_BUFSIZ 512
if (buf == NULL) {
buflen = GPRINTF_BUFSIZ;
- emalloc(buf, char *, buflen * sizeof(char), "gprintf");
+ emalloc(buf, char *, buflen * sizeof(char));
} else if (buflen - bl < GPRINTF_BUFSIZ/2) {
buflen += GPRINTF_BUFSIZ;
- erealloc(buf, char *, buflen * sizeof(char), "gprintf");
+ erealloc(buf, char *, buflen * sizeof(char));
}
#undef GPRINTF_BUFSIZ
@@ -4427,7 +4427,7 @@ gprintf(FILE *fp, const char *format, ...)
/* enlarge buffer, and try again */
buflen *= 2;
- erealloc(buf, char *, buflen * sizeof(char), "gprintf");
+ erealloc(buf, char *, buflen * sizeof(char));
}
bl = 0;
@@ -4557,7 +4557,7 @@ serialize_list(int type)
if (buf == NULL) { /* first time */
buflen = SERIALIZE_BUFSIZ;
- emalloc(buf, char *, buflen + 1, "serialize");
+ emalloc(buf, char *, buflen + 1);
}
bl = 0;
@@ -4566,7 +4566,7 @@ serialize_list(int type)
if (buflen - bl < SERIALIZE_BUFSIZ/2) {
enlarge_buffer:
buflen *= 2;
- erealloc(buf, char *, buflen + 1, "serialize");
+ erealloc(buf, char *, buflen + 1);
}
#undef SERIALIZE_BUFSIZ
@@ -4670,7 +4670,7 @@ enlarge_buffer:
nchar += (strlen("commands ") + 20 /*cnum*/ + 1
/*CSEP*/ + strlen("end") + 1 /*FSEP*/);
if (nchar >= buflen - bl) {
buflen = bl + nchar + 1 /*RSEP*/;
- erealloc(buf, char *, buflen + 1,
"serialize_list");
+ erealloc(buf, char *, buflen + 1);
}
nchar = sprintf(buf + bl, "commands %d", cnum);
bl += nchar;
@@ -4707,7 +4707,7 @@ enlarge_buffer:
nchar = strlen(cndn->expr);
if (nchar + 1 /*FSEP*/ >= buflen - bl) {
buflen = bl + nchar + 1 /*FSEP*/ + 1
/*RSEP*/;
- erealloc(buf, char *, buflen + 1,
"serialize_list");
+ erealloc(buf, char *, buflen + 1);
}
memcpy(buf + bl, cndn->expr, nchar);
bl += nchar;
@@ -4786,7 +4786,7 @@ unserialize_list_item(struct list_item *list, char
**pstr, int *pstr_len, int fi
if (type == D_subscript) {
int sub_len;
sub_cnt = strtol(pstr[3], NULL, 0);
- emalloc(subs, NODE **, sub_cnt * sizeof(NODE *),
"unserialize_list_item");
+ emalloc(subs, NODE **, sub_cnt * sizeof(NODE *));
cnt++;
for (i = 0; i < sub_cnt; i++) {
sub_len = strtol(pstr[cnt], NULL, 0);
@@ -5095,7 +5095,7 @@ do_commands(CMDARG *arg, int cmd)
assert(commands != NULL);
- emalloc(c, struct commands_item *, sizeof(struct commands_item),
"do_commands");
+ emalloc(c, struct commands_item *, sizeof(struct commands_item));
c->next = NULL;
c->cmd = cmd;
@@ -5151,7 +5151,7 @@ do_print_f(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
/* count maximum required size for tmp */
for (a = arg; a != NULL ; a = a->next)
count++;
- emalloc(tmp, NODE **, count * sizeof(NODE *), "do_print_f");
+ emalloc(tmp, NODE **, count * sizeof(NODE *));
for (i = 0, a = arg; a != NULL ; i++, a = a->next) {
switch (a->type) {
@@ -5720,9 +5720,9 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
if (ecount > 0) {
if (pcount == 0)
- emalloc(this_frame->stack, NODE **, ecount *
sizeof(NODE *), "do_eval");
+ emalloc(this_frame->stack, NODE **, ecount *
sizeof(NODE *));
else
- erealloc(this_frame->stack, NODE **, (pcount +
ecount) * sizeof(NODE *), "do_eval");
+ erealloc(this_frame->stack, NODE **, (pcount +
ecount) * sizeof(NODE *));
sp = this_frame->stack + pcount;
for (i = 0; i < ecount; i++) {
@@ -5964,7 +5964,7 @@ push_cmd_src(
int eofstatus)
{
struct command_source *cs;
- emalloc(cs, struct command_source *, sizeof(struct command_source),
"push_cmd_src");
+ emalloc(cs, struct command_source *, sizeof(struct command_source));
cs->fd = fd;
cs->is_tty = istty;
cs->read_func = readfunc;
diff --git a/eval.c b/eval.c
index 613dfab2..6e18344f 100644
--- a/eval.c
+++ b/eval.c
@@ -651,10 +651,10 @@ push_frame(NODE *f)
fcall_count++;
if (fcall_list == NULL) {
max_fcall = 10;
- emalloc(fcall_list, NODE **, (max_fcall + 1) * sizeof(NODE *),
"push_frame");
+ emalloc(fcall_list, NODE **, (max_fcall + 1) * sizeof(NODE *));
} else if (fcall_count == max_fcall) {
max_fcall *= 2;
- erealloc(fcall_list, NODE **, (max_fcall + 1) * sizeof(NODE *),
"push_frame");
+ erealloc(fcall_list, NODE **, (max_fcall + 1) * sizeof(NODE *));
}
if (fcall_count > 1)
@@ -826,9 +826,9 @@ set_OFS()
new_ofs_len = OFS_node->var_value->stlen;
if (OFS == NULL)
- emalloc(OFS, char *, new_ofs_len + 1, "set_OFS");
+ emalloc(OFS, char *, new_ofs_len + 1);
else if (OFSlen < new_ofs_len)
- erealloc(OFS, char *, new_ofs_len + 1, "set_OFS");
+ erealloc(OFS, char *, new_ofs_len + 1);
memcpy(OFS, OFS_node->var_value->stptr, OFS_node->var_value->stlen);
OFSlen = new_ofs_len;
@@ -900,7 +900,7 @@ fmt_index(NODE *n)
char save;
if (fmt_list == NULL)
- emalloc(fmt_list, NODE **, fmt_num*sizeof(*fmt_list),
"fmt_index");
+ emalloc(fmt_list, NODE **, fmt_num*sizeof(*fmt_list));
n = force_string(n);
save = n->stptr[n->stlen];
@@ -923,7 +923,7 @@ fmt_index(NODE *n)
if (fmt_hiwater >= fmt_num) {
fmt_num *= 2;
- erealloc(fmt_list, NODE **, fmt_num * sizeof(*fmt_list),
"fmt_index");
+ erealloc(fmt_list, NODE **, fmt_num * sizeof(*fmt_list));
}
fmt_list[fmt_hiwater] = dupnode(n);
return fmt_hiwater++;
@@ -1129,7 +1129,7 @@ STACK_ITEM *
grow_stack()
{
STACK_SIZE *= 2;
- erealloc(stack_bottom, STACK_ITEM *, STACK_SIZE * sizeof(STACK_ITEM),
"grow_stack");
+ erealloc(stack_bottom, STACK_ITEM *, STACK_SIZE * sizeof(STACK_ITEM));
stack_top = stack_bottom + STACK_SIZE - 1;
stack_ptr = stack_bottom + STACK_SIZE / 2;
return stack_ptr;
@@ -1283,7 +1283,7 @@ setup_frame(INSTRUCTION *pc)
arg_count = (pc + 1)->expr_count;
if (pcount > 0) {
- ezalloc(sp, NODE **, pcount * sizeof(NODE *), "setup_frame");
+ ezalloc(sp, NODE **, pcount * sizeof(NODE *));
}
/* check for extra args */
@@ -1775,7 +1775,7 @@ push_exec_state(INSTRUCTION *cp, int rule, char *src,
STACK_ITEM *sp)
{
EXEC_STATE *es;
- emalloc(es, EXEC_STATE *, sizeof(EXEC_STATE), "push_exec_state");
+ emalloc(es, EXEC_STATE *, sizeof(EXEC_STATE));
es->rule = rule;
es->cptr = cp;
es->stack_size = (sp - stack_bottom) + 1;
@@ -1866,7 +1866,7 @@ init_interpret()
if ((newval = getenv_long("GAWK_STACKSIZE")) > 0)
STACK_SIZE = newval;
- emalloc(stack_bottom, STACK_ITEM *, STACK_SIZE * sizeof(STACK_ITEM),
"grow_stack");
+ emalloc(stack_bottom, STACK_ITEM *, STACK_SIZE * sizeof(STACK_ITEM));
stack_ptr = stack_bottom - 1;
stack_top = stack_bottom + STACK_SIZE - 1;
diff --git a/ext.c b/ext.c
index 89b53ab5..26894bf1 100644
--- a/ext.c
+++ b/ext.c
@@ -112,7 +112,7 @@ make_builtin(const char *name_space, const awk_ext_func_t
*funcinfo)
size_t len = strlen(name_space) + 2 + strlen(name) + 1;
char *buf;
- emalloc(buf, char *, len, "make_builtin");
+ emalloc(buf, char *, len);
sprintf(buf, "%s::%s", name_space, name);
install_name = buf;
diff --git a/field.c b/field.c
index 8007dd9a..ced32066 100644
--- a/field.c
+++ b/field.c
@@ -100,7 +100,7 @@ NODE *Null_field = NULL;
void
init_fields()
{
- emalloc(fields_arr, NODE **, sizeof(NODE *), "init_fields");
+ emalloc(fields_arr, NODE **, sizeof(NODE *));
fields_arr[0] = make_string("", 0);
fields_arr[0]->flags |= NULL_FIELD;
@@ -131,7 +131,7 @@ grow_fields_arr(long num)
int t;
NODE *n;
- erealloc(fields_arr, NODE **, (num + 1) * sizeof(NODE *),
"grow_fields_arr");
+ erealloc(fields_arr, NODE **, (num + 1) * sizeof(NODE *));
for (t = nf_high_water + 1; t <= num; t++) {
getnode(n);
*n = *Null_field;
@@ -207,7 +207,7 @@ rebuild_record()
tlen += (NF - 1) * OFSlen;
if ((long) tlen < 0)
tlen = 0;
- emalloc(ops, char *, tlen + 1, "rebuild_record");
+ emalloc(ops, char *, tlen + 1);
cops = ops;
ops[0] = '\0';
for (i = 1; i <= NF; i++) {
@@ -256,7 +256,7 @@ rebuild_record()
* we can't leave r's stptr pointing into the
* old $0 buffer that we are about to unref.
*/
- emalloc(r->stptr, char *, r->stlen + 1,
"rebuild_record");
+ emalloc(r->stptr, char *, r->stlen + 1);
memcpy(r->stptr, cops, r->stlen);
r->stptr[r->stlen] = '\0';
r->flags |= MALLOC;
@@ -306,7 +306,7 @@ set_record(const char *buf, size_t cnt, const
awk_fieldwidth_info_t *fw)
/* buffer management: */
if (databuf_size == 0) { /* first time */
- ezalloc(databuf, char *, INITIAL_SIZE, "set_record");
+ ezalloc(databuf, char *, INITIAL_SIZE);
databuf_size = INITIAL_SIZE;
}
/*
@@ -320,7 +320,7 @@ set_record(const char *buf, size_t cnt, const
awk_fieldwidth_info_t *fw)
fatal(_("input record too large"));
databuf_size *= 2;
} while (cnt >= databuf_size);
- erealloc(databuf, char *, databuf_size, "set_record");
+ erealloc(databuf, char *, databuf_size);
memset(databuf, '\0', databuf_size);
}
/* copy the data */
@@ -400,7 +400,7 @@ purge_record()
if ((r->flags & MALLOC) == 0 && r->valref > 1) {
/* This can and does happen. We must copy the string! */
const char *save = r->stptr;
- emalloc(r->stptr, char *, r->stlen + 1, "purge_record");
+ emalloc(r->stptr, char *, r->stlen + 1);
memcpy(r->stptr, save, r->stlen);
r->stptr[r->stlen] = '\0';
r->flags |= MALLOC;
@@ -801,7 +801,7 @@ comma_parse_field(long up_to, /* parse only up to
this field number */
static size_t buflen = 0;
if (newfield == NULL) {
- emalloc(newfield, char *, BUFSIZ, "comma_parse_field");
+ emalloc(newfield, char *, BUFSIZ);
buflen = BUFSIZ;
}
@@ -830,7 +830,7 @@ comma_parse_field(long up_to, /* parse only up to
this field number */
size_t offset = buflen;
buflen *= 2;
- erealloc(newfield, char *,
buflen, "comma_parse_field");
+ erealloc(newfield, char *,
buflen);
new_end = newfield + offset;
}
@@ -853,7 +853,7 @@ comma_parse_field(long up_to, /* parse only up to
this field number */
size_t offset = buflen;
buflen *= 2;
- erealloc(newfield, char *,
buflen, "comma_parse_field");
+ erealloc(newfield, char *,
buflen);
new_end = newfield + offset;
}
*new_end++ = *scan++;
@@ -1348,7 +1348,7 @@ set_FIELDWIDTHS()
scan = tmp->stptr;
if (FIELDWIDTHS == NULL) {
- emalloc(FIELDWIDTHS, awk_fieldwidth_info_t *,
awk_fieldwidth_info_size(fw_alloc), "set_FIELDWIDTHS");
+ emalloc(FIELDWIDTHS, awk_fieldwidth_info_t *,
awk_fieldwidth_info_size(fw_alloc));
FIELDWIDTHS->use_chars = awk_true;
}
FIELDWIDTHS->nf = 0;
@@ -1356,7 +1356,7 @@ set_FIELDWIDTHS()
unsigned long int tmp;
if (i >= fw_alloc) {
fw_alloc *= 2;
- erealloc(FIELDWIDTHS, awk_fieldwidth_info_t *,
awk_fieldwidth_info_size(fw_alloc), "set_FIELDWIDTHS");
+ erealloc(FIELDWIDTHS, awk_fieldwidth_info_t *,
awk_fieldwidth_info_size(fw_alloc));
}
/* Ensure that there is no leading `-' sign. Otherwise,
strtoul would accept it and return a bogus result. */
diff --git a/gawkapi.c b/gawkapi.c
index d9275ec5..c32df77a 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -433,7 +433,7 @@ api_awk_atexit(awk_ext_id_t id,
return;
/* allocate memory */
- emalloc(p, struct ext_exit_handler *, sizeof(struct ext_exit_handler),
"api_awk_atexit");
+ emalloc(p, struct ext_exit_handler *, sizeof(struct ext_exit_handler));
/* fill it in */
p->funcp = funcp;
@@ -481,9 +481,9 @@ assign_string(NODE *node, awk_value_t *val, awk_valtype_t
val_type)
scopy.size = 8; /* initial size */
else
scopy.size *= 2;
- erealloc(scopy.strings, char **, scopy.size *
sizeof(char *), "assign_string");
+ erealloc(scopy.strings, char **, scopy.size *
sizeof(char *));
}
- emalloc(s, char *, node->stlen + 1, "assign_string");
+ emalloc(s, char *, node->stlen + 1);
memcpy(s, node->stptr, node->stlen);
s[node->stlen] = '\0';
val->str_value.str = scopy.strings[scopy.i++] = s;
@@ -1248,8 +1248,7 @@ api_flatten_array_typed(awk_ext_id_t id,
alloc_size = sizeof(awk_flat_array_t) +
(array->table_size - 1) * sizeof(awk_element_t);
- ezalloc(*data, awk_flat_array_t *, alloc_size,
- "api_flatten_array_typed");
+ ezalloc(*data, awk_flat_array_t *, alloc_size);
list = assoc_list(array, "@unsorted", ASORTI);
@@ -1363,7 +1362,7 @@ api_get_mpfr(awk_ext_id_t id)
{
#ifdef HAVE_MPFR
mpfr_ptr p;
- emalloc(p, mpfr_ptr, sizeof(mpfr_t), "api_get_mpfr");
+ emalloc(p, mpfr_ptr, sizeof(mpfr_t));
mpfr_init(p);
return p;
#else
@@ -1379,7 +1378,7 @@ api_get_mpz(awk_ext_id_t id)
{
#ifdef HAVE_MPFR
mpz_ptr p;
- emalloc(p, mpz_ptr, sizeof (mpz_t), "api_get_mpz");
+ emalloc(p, mpz_ptr, sizeof (mpz_t));
mpz_init(p);
return p;
@@ -1505,7 +1504,7 @@ api_register_ext_version(awk_ext_id_t id, const char
*version)
(void) id;
- emalloc(info, struct version_info *, sizeof(struct version_info),
"register_ext_version");
+ emalloc(info, struct version_info *, sizeof(struct version_info));
info->version = version;
info->next = vi_head;
vi_head = info;
@@ -1665,7 +1664,7 @@ ns_lookup(const char *name_space, const char *name, char
**fullname)
size_t len = strlen(name_space) + 2 + strlen(name) + 1;
char *buf;
- emalloc(buf, char *, len, "ns_lookup");
+ emalloc(buf, char *, len);
sprintf(buf, "%s::%s", name_space, name);
NODE *f = lookup(buf);
diff --git a/int_array.c b/int_array.c
index 3a1c5966..0ae91b55 100644
--- a/int_array.c
+++ b/int_array.c
@@ -458,7 +458,7 @@ int_copy(NODE *symbol, NODE *newsymb)
cursize = symbol->array_size;
/* allocate new table */
- ezalloc(new, BUCKET **, cursize * sizeof(BUCKET *), "int_copy");
+ ezalloc(new, BUCKET **, cursize * sizeof(BUCKET *));
old = symbol->buckets;
@@ -547,10 +547,10 @@ int_list(NODE *symbol, NODE *t)
assert(list != NULL);
if (num_elems == 1 || num_elems == xn->table_size)
return list;
- erealloc(list, NODE **, list_size * sizeof(NODE *), "int_list");
+ erealloc(list, NODE **, list_size * sizeof(NODE *));
k = elem_size * xn->table_size;
} else
- emalloc(list, NODE **, list_size * sizeof(NODE *), "int_list");
+ emalloc(list, NODE **, list_size * sizeof(NODE *));
/* populate it */
@@ -841,7 +841,7 @@ grow_int_table(NODE *symbol)
}
/* allocate new table */
- ezalloc(new, BUCKET **, newsize * sizeof(BUCKET *), "grow_int_table");
+ ezalloc(new, BUCKET **, newsize * sizeof(BUCKET *));
old = symbol->buckets;
symbol->buckets = new;
diff --git a/interpret.h b/interpret.h
index e9cb94ae..afba82f8 100644
--- a/interpret.h
+++ b/interpret.h
@@ -843,7 +843,7 @@ mod:
if (t1 != t2 && t1->valref == 1 && (t1->flags &
(MALLOC|MPFN|MPZN)) == MALLOC) {
size_t nlen = t1->stlen + t2->stlen;
- erealloc(t1->stptr, char *, nlen + 1,
"r_interpret");
+ erealloc(t1->stptr, char *, nlen + 1);
memcpy(t1->stptr + t1->stlen, t2->stptr,
t2->stlen);
t1->stlen = nlen;
t1->stptr[nlen] = '\0';
@@ -859,8 +859,7 @@ mod:
if ((t1->flags & WSTRCUR) != 0 && (t2->flags &
WSTRCUR) != 0) {
size_t wlen = t1->wstlen + t2->wstlen;
- erealloc(t1->wstptr, wchar_t *,
- sizeof(wchar_t) * (wlen
+ 1), "r_interpret");
+ erealloc(t1->wstptr, wchar_t *,
sizeof(wchar_t) * (wlen + 1));
memcpy(t1->wstptr + t1->wstlen,
t2->wstptr, t2->wstlen * sizeof(wchar_t));
t1->wstlen = wlen;
t1->wstptr[wlen] = L'\0';
@@ -870,7 +869,7 @@ mod:
size_t nlen = t1->stlen + t2->stlen;
char *p;
- emalloc(p, char *, nlen + 1, "r_interpret");
+ emalloc(p, char *, nlen + 1);
memcpy(p, t1->stptr, t1->stlen);
memcpy(p + t1->stlen, t2->stptr, t2->stlen);
/* N.B. No NUL-termination required, since
make_str_node will do it. */
diff --git a/io.c b/io.c
index 89bdb542..2a9d9ca5 100644
--- a/io.c
+++ b/io.c
@@ -900,8 +900,8 @@ redirect_string(const char *str, size_t explen, bool
not_string,
rp = save_rp;
efree(rp->value);
} else
- emalloc(rp, struct redirect *, sizeof(struct redirect),
"redirect");
- emalloc(newstr, char *, explen + 1, "redirect");
+ emalloc(rp, struct redirect *, sizeof(struct redirect));
+ emalloc(newstr, char *, explen + 1);
memcpy(newstr, str, explen);
newstr[explen] = '\0';
str = newstr;
@@ -2977,7 +2977,7 @@ init_awkpath(path_info *pi)
max_path++;
// +3 --> 2 for null entries at front and end of path, 1 for NULL end
of list
- ezalloc(pi->awkpath, const char **, (max_path + 3) * sizeof(char *),
"init_awkpath");
+ ezalloc(pi->awkpath, const char **, (max_path + 3) * sizeof(char *));
start = path;
i = 0;
@@ -3007,7 +3007,7 @@ init_awkpath(path_info *pi)
len = end - start;
if (len > 0) {
- emalloc(p, char *, len + 2, "init_awkpath");
+ emalloc(p, char *, len + 2);
memcpy(p, start, len);
/* add directory punctuation if necessary */
@@ -3039,7 +3039,7 @@ do_find_source(const char *src, struct stat *stb, int
*errcode, path_info *pi)
/* some kind of path name, no search */
if (ispath(src)) {
- emalloc(path, char *, strlen(src) + 1, "do_find_source");
+ emalloc(path, char *, strlen(src) + 1);
strcpy(path, src);
if (stat(path, stb) == 0)
return path;
@@ -3051,7 +3051,7 @@ do_find_source(const char *src, struct stat *stb, int
*errcode, path_info *pi)
if (pi->awkpath == NULL)
init_awkpath(pi);
- emalloc(path, char *, pi->max_pathlen + strlen(src) + 1,
"do_find_source");
+ emalloc(path, char *, pi->max_pathlen + strlen(src) + 1);
for (i = 0; pi->awkpath[i] != NULL; i++) {
if (strcmp(pi->awkpath[i], "./") == 0 || strcmp(pi->awkpath[i],
".") == 0)
*path = '\0';
@@ -3097,7 +3097,7 @@ find_source(const char *src, struct stat *stb, int
*errcode, int is_extlib)
/* append EXTLIB_SUFFIX and try again */
save_errno = errno;
- emalloc(file_ext, char *, src_len + suffix_len + 1,
"find_source");
+ emalloc(file_ext, char *, src_len + suffix_len + 1);
sprintf(file_ext, "%s%s", src, EXTLIB_SUFFIX);
path = do_find_source(file_ext, stb, errcode, pi);
efree(file_ext);
@@ -3124,8 +3124,7 @@ find_source(const char *src, struct stat *stb, int
*errcode, int is_extlib)
#endif
/* append ".awk" and try again */
- emalloc(file_awk, char *, strlen(src) +
- sizeof(DEFAULT_FILETYPE) + 1, "find_source");
+ emalloc(file_awk, char *, strlen(src) +
sizeof(DEFAULT_FILETYPE) + 1);
sprintf(file_awk, "%s%s", src, DEFAULT_FILETYPE);
path = do_find_source(file_awk, stb, errcode, pi);
efree(file_awk);
@@ -3384,7 +3383,7 @@ iop_alloc(int fd, const char *name, int errno_val)
{
IOBUF *iop;
- ezalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc");
+ ezalloc(iop, IOBUF *, sizeof(IOBUF));
iop->public.fd = fd;
iop->public.name = name;
@@ -3459,7 +3458,7 @@ iop_finish(IOBUF *iop)
lintwarn(_("data file `%s' is empty"), iop->public.name);
iop->errcode = errno = 0;
iop->count = iop->scanoff = 0;
- emalloc(iop->buf, char *, iop->size += 1, "iop_finish");
+ emalloc(iop->buf, char *, iop->size += 1);
iop->off = iop->buf;
iop->dataend = NULL;
iop->end = iop->buf + iop->size;
@@ -3509,7 +3508,7 @@ grow_iop_buffer(IOBUF *iop)
fatal(_("could not allocate more input memory"));
iop->size = newsize;
- erealloc(iop->buf, char *, iop->size, "grow_iop_buffer");
+ erealloc(iop->buf, char *, iop->size);
iop->off = iop->buf + off;
iop->dataend = iop->off + valid;
iop->end = iop->buf + iop->size;
@@ -4397,7 +4396,7 @@ in_PROCINFO(const char *pidx1, const char *pidx2, NODE
**full_idx)
str_len = strlen(pidx1) + subsep->stlen + strlen(pidx2);
if (sub == NULL) {
- emalloc(str, char *, str_len + 1, "in_PROCINFO");
+ emalloc(str, char *, str_len + 1);
sub = make_str_node(str, str_len, ALREADY_MALLOCED);
if (full_idx)
*full_idx = sub;
@@ -4405,7 +4404,7 @@ in_PROCINFO(const char *pidx1, const char *pidx2, NODE
**full_idx)
/* *full_idx != NULL */
assert(sub->valref == 1);
- erealloc(sub->stptr, char *, str_len + 1, "in_PROCINFO");
+ erealloc(sub->stptr, char *, str_len + 1);
sub->stlen = str_len;
}
@@ -4630,8 +4629,7 @@ gawk_popen_write(const char *cmd)
if (open_pipes == NULL) {
int count = getdtablesize();
- emalloc(open_pipes, write_pipe *, sizeof(write_pipe) * count,
- "gawk_popen_write");
+ emalloc(open_pipes, write_pipe *, sizeof(write_pipe) * count);
memset(open_pipes, 0, sizeof(write_pipe) * count);
}
diff --git a/main.c b/main.c
index 9c6e66ef..e50b1890 100644
--- a/main.c
+++ b/main.c
@@ -576,13 +576,11 @@ add_preassign(enum assign_type type, char *val)
++numassigns;
if (preassigns == NULL) {
- emalloc(preassigns, struct pre_assign *,
- INIT_SRC * sizeof(struct pre_assign), "add_preassign");
+ emalloc(preassigns, struct pre_assign *, INIT_SRC *
sizeof(struct pre_assign));
alloc_assigns = INIT_SRC;
} else if (numassigns >= alloc_assigns) {
alloc_assigns *= 2;
- erealloc(preassigns, struct pre_assign *,
- alloc_assigns * sizeof(struct pre_assign),
"add_preassigns");
+ erealloc(preassigns, struct pre_assign *, alloc_assigns *
sizeof(struct pre_assign));
}
preassigns[numassigns].type = type;
preassigns[numassigns].val = estrdup(val, strlen(val));
@@ -1249,7 +1247,7 @@ arg_assign(char *arg, bool initing)
// typed regex
size_t len = strlen(cp) - 3;
- ezalloc(cp2, char *, len + 1, "arg_assign");
+ ezalloc(cp2, char *, len + 1);
memcpy(cp2, cp + 2, len);
it = make_typed_regex(cp2, len);
@@ -1449,7 +1447,7 @@ init_groupset()
return;
/* fill in groups */
- emalloc(groupset, GETGROUPS_T *, ngroups * sizeof(GETGROUPS_T),
"init_groupset");
+ emalloc(groupset, GETGROUPS_T *, ngroups * sizeof(GETGROUPS_T));
ngroups = getgroups(ngroups, groupset);
/* same thing here, give up but keep going */
@@ -1467,7 +1465,7 @@ char *
estrdup(const char *str, size_t len)
{
char *s;
- emalloc(s, char *, len + 1, "estrdup");
+ emalloc(s, char *, len + 1);
memcpy(s, str, len);
s[len] = '\0';
return s;
@@ -1512,7 +1510,7 @@ save_argv(int argc, char **argv)
{
int i;
- emalloc(d_argv, char **, (argc + 1) * sizeof(char *), "save_argv");
+ emalloc(d_argv, char **, (argc + 1) * sizeof(char *));
for (i = 0; i < argc; i++)
d_argv[i] = estrdup(argv[i], strlen(argv[i]));
d_argv[argc] = NULL;
diff --git a/mpfr.c b/mpfr.c
index ac0fa380..e783a5bb 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -980,7 +980,7 @@ get_intval(NODE *t1, int argnum, const char *op)
op, argnum, left)
);
- emalloc(pz, mpz_ptr, sizeof (mpz_t), "get_intval");
+ emalloc(pz, mpz_ptr, sizeof (mpz_t));
mpz_init(pz);
return pz; /* should be freed */
}
@@ -999,7 +999,7 @@ get_intval(NODE *t1, int argnum, const char *op)
);
}
- emalloc(pz, mpz_ptr, sizeof (mpz_t), "get_intval");
+ emalloc(pz, mpz_ptr, sizeof (mpz_t));
mpz_init(pz);
mpfr_get_z(pz, left, MPFR_RNDZ); /* float to integer
conversion */
return pz; /* should be freed */
diff --git a/node.c b/node.c
index 181152dd..3e3bd109 100644
--- a/node.c
+++ b/node.c
@@ -294,7 +294,7 @@ r_format_val(const char *format, int index, NODE *s)
}
if ((s->flags & (MALLOC|STRCUR)) == (MALLOC|STRCUR))
efree(s->stptr);
- emalloc(s->stptr, char *, s->stlen + 1, "format_val");
+ emalloc(s->stptr, char *, s->stlen + 1);
memcpy(s->stptr, sp, s->stlen + 1);
no_malloc:
s->flags |= STRCUR;
@@ -343,13 +343,13 @@ r_dupnode(NODE *n)
r->wstlen = 0;
if ((n->flags & STRCUR) != 0) {
- emalloc(r->stptr, char *, n->stlen + 1, "r_dupnode");
+ emalloc(r->stptr, char *, n->stlen + 1);
memcpy(r->stptr, n->stptr, n->stlen);
r->stptr[n->stlen] = '\0';
r->stlen = n->stlen;
if ((n->flags & WSTRCUR) != 0) {
r->wstlen = n->wstlen;
- emalloc(r->wstptr, wchar_t *, sizeof(wchar_t) *
(n->wstlen + 1), "r_dupnode");
+ emalloc(r->wstptr, wchar_t *, sizeof(wchar_t) *
(n->wstlen + 1));
memcpy(r->wstptr, n->wstptr, n->wstlen *
sizeof(wchar_t));
r->wstptr[n->wstlen] = L'\0';
r->flags |= WSTRCUR;
@@ -416,7 +416,7 @@ make_str_node(const char *s, size_t len, int flags)
if ((flags & ALREADY_MALLOCED) != 0)
r->stptr = (char *) s;
else {
- emalloc(r->stptr, char *, len + 1, "make_str_node");
+ emalloc(r->stptr, char *, len + 1);
memcpy(r->stptr, s, len);
}
r->stptr[len] = '\0';
@@ -488,7 +488,7 @@ make_str_node(const char *s, size_t len, int flags)
*ptm++ = c;
}
len = ptm - r->stptr;
- erealloc(r->stptr, char *, len + 1, "make_str_node");
+ erealloc(r->stptr, char *, len + 1);
r->stptr[len] = '\0';
}
r->stlen = len;
@@ -826,7 +826,7 @@ str2wstr(NODE *n, size_t **ptr)
* Create the array.
*/
if (ptr != NULL) {
- ezalloc(*ptr, size_t *, sizeof(size_t) * (n->stlen + 1),
"str2wstr");
+ ezalloc(*ptr, size_t *, sizeof(size_t) * (n->stlen + 1));
}
/*
@@ -859,7 +859,7 @@ str2wstr(NODE *n, size_t **ptr)
* realloc the wide string down in size.
*/
- emalloc(n->wstptr, wchar_t *, sizeof(wchar_t) * (n->stlen + 1),
"str2wstr");
+ emalloc(n->wstptr, wchar_t *, sizeof(wchar_t) * (n->stlen + 1));
wsp = n->wstptr;
sp = n->stptr;
@@ -941,7 +941,7 @@ str2wstr(NODE *n, size_t **ptr)
n->flags |= WSTRCUR;
#define ARBITRARY_AMOUNT_TO_GIVE_BACK 100
if (n->stlen - n->wstlen > ARBITRARY_AMOUNT_TO_GIVE_BACK)
- erealloc(n->wstptr, wchar_t *, sizeof(wchar_t) * (n->wstlen +
1), "str2wstr");
+ erealloc(n->wstptr, wchar_t *, sizeof(wchar_t) * (n->wstlen +
1));
return n;
}
@@ -968,7 +968,7 @@ wstr2str(NODE *n)
memset(& mbs, 0, sizeof(mbs));
length = n->wstlen;
- emalloc(newval, char *, (length * gawk_mb_cur_max) + 1, "wstr2str");
+ emalloc(newval, char *, (length * gawk_mb_cur_max) + 1);
wp = n->wstptr;
for (cp = newval; length > 0; length--) {
@@ -1149,7 +1149,7 @@ void *
r_getblock(int id)
{
void *res;
- emalloc(res, void *, nextfree[id].size, "getblock");
+ emalloc(res, void *, nextfree[id].size);
nextfree[id].active++;
if (nextfree[id].highwater < nextfree[id].active)
nextfree[id].highwater = nextfree[id].active;
@@ -1179,7 +1179,7 @@ more_blocks(int id)
size = nextfree[id].size;
assert(size >= sizeof(struct block_item));
- emalloc(freep, struct block_item *, BLOCKCHUNK * size, "more_blocks");
+ emalloc(freep, struct block_item *, BLOCKCHUNK * size);
p = (char *) freep;
endp = p + BLOCKCHUNK * size;
diff --git a/printf.c b/printf.c
index 2410fde5..8187c886 100644
--- a/printf.c
+++ b/printf.c
@@ -126,7 +126,7 @@ format_args(
#define bchunk(s, l) if (l) { \
while ((l) > ofre) { \
size_t olen = obufout - obuf; \
- erealloc(obuf, char *, osiz * 2, "format_args"); \
+ erealloc(obuf, char *, osiz * 2); \
ofre += osiz; \
osiz *= 2; \
obufout = obuf + olen; \
@@ -140,7 +140,7 @@ format_args(
#define bchunk_one(s) { \
if (ofre < 1) { \
size_t olen = obufout - obuf; \
- erealloc(obuf, char *, osiz * 2, "format_args"); \
+ erealloc(obuf, char *, osiz * 2); \
ofre += osiz; \
osiz *= 2; \
obufout = obuf + olen; \
@@ -153,7 +153,7 @@ format_args(
#define chksize(l) if ((l) >= ofre) { \
size_t olen = obufout - obuf; \
size_t delta = osiz+l-ofre; \
- erealloc(obuf, char *, osiz + delta, "format_args"); \
+ erealloc(obuf, char *, osiz + delta); \
obufout = obuf + olen; \
ofre += delta; \
osiz += delta; \
@@ -201,7 +201,7 @@ format_args(
const char *formatted = NULL;
#define INITIAL_OUT_SIZE 64
- emalloc(obuf, char *, INITIAL_OUT_SIZE, "format_args");
+ emalloc(obuf, char *, INITIAL_OUT_SIZE);
obufout = obuf;
osiz = INITIAL_OUT_SIZE;
ofre = osiz - 1;
@@ -752,7 +752,7 @@ out0:
olen_final = obufout - obuf;
#define GIVE_BACK_SIZE (INITIAL_OUT_SIZE * 2)
if (ofre > GIVE_BACK_SIZE)
- erealloc(obuf, char *, olen_final + 1, "format_args");
+ erealloc(obuf, char *, olen_final + 1);
r = make_str_node(obuf, olen_final, ALREADY_MALLOCED);
obuf = NULL;
out:
@@ -901,7 +901,7 @@ format_integer_digits(NODE *arg, struct flags *flags, bool
*used_float)
double tmpval;
#define growbuffer(buf, buflen, cp) { \
- erealloc(buf, char *, buflen * 2, "format_integer_xxx"); \
+ erealloc(buf, char *, buflen * 2); \
cp = buf + buflen; \
buflen *= 2; \
}
@@ -909,7 +909,7 @@ format_integer_digits(NODE *arg, struct flags *flags, bool
*used_float)
#if defined(HAVE_LOCALE_H)
quote_flag = (flags->quote && loc.thousands_sep[0] != '\0');
#endif
- emalloc(buf, char *, VALUE_SIZE, "format_integer_digits");
+ emalloc(buf, char *, VALUE_SIZE);
buflen = VALUE_SIZE;
cp = buf;
@@ -930,7 +930,7 @@ format_integer_digits(NODE *arg, struct flags *flags, bool
*used_float)
else
buflen *= 2;
assert(buflen > 0);
- erealloc(buf, char *, buflen, "format_args");
+ erealloc(buf, char *, buflen);
}
} else {
// octal or hex or unsigned decimal
@@ -1049,7 +1049,7 @@ format_signed_integer(NODE *arg, struct flags *flags)
fw -= (flags->negative || flags->space || flags->plus);
- emalloc(buf1, char *, buflen, "format_signed_integer");
+ emalloc(buf1, char *, buflen);
strcpy(buf1, number_value);
free((void *) number_value);
cp = buf1 + val_len;
@@ -1071,7 +1071,7 @@ format_signed_integer(NODE *arg, struct flags *flags)
return fill_to_field_width(buf1, flags, ' ');
} else if ((flags->plus || flags->space) && ! flags->negative) {
- emalloc(buf1, char *, val_len + 2, "format_signed_integer");
+ emalloc(buf1, char *, val_len + 2);
if (flags->plus) {
sprintf(buf1, "+%s", number_value);
} else {
@@ -1299,7 +1299,7 @@ mpf1:
}
fmt0:
buflen = flags->field_width + flags->precision + 11; /* 11 == slop */
- emalloc(buf, char *, buflen, "format_mpg_integer");
+ emalloc(buf, char *, buflen);
#if defined(LC_NUMERIC)
@@ -1310,7 +1310,7 @@ fmt0:
sprintf(cpbuf, "%%Z%c", flags->format);
while ((nc = mpfr_snprintf(buf, buflen, cpbuf, zi)) >= (int) buflen) {
buflen *= 2;
- erealloc(buf, char *, buflen, "format_mpg_integer");
+ erealloc(buf, char *, buflen);
}
#if defined(LC_NUMERIC)
@@ -1446,7 +1446,7 @@ format_float(NODE *arg, struct flags *flags)
buflen = flags->field_width + flags->precision + 11; /* 11 == slop */
- emalloc(buf, char *, buflen, "format_float");
+ emalloc(buf, char *, buflen);
int signchar = '\0';
if (flags->plus)
@@ -1477,7 +1477,7 @@ format_float(NODE *arg, struct flags *flags)
sprintf(cp, "*.*R*%c", flags->format);
while ((nc = mpfr_snprintf(buf, buflen, cpbuf,
flags->field_width, flags->precision, ROUND_MODE,
mf)) >= (int) buflen) {
- erealloc(buf, char *, buflen * 2, "format_float");
+ erealloc(buf, char *, buflen * 2);
buflen *= 2;
}
#else
@@ -1489,7 +1489,7 @@ format_float(NODE *arg, struct flags *flags)
while ((nc = snprintf(buf, buflen, cpbuf,
flags->field_width, flags->precision,
(double) tmpval)) >= (int) buflen) {
- erealloc(buf, char *, buflen * 2,
"format_float");
+ erealloc(buf, char *, buflen * 2);
buflen *= 2;
}
} else {
@@ -1499,7 +1499,7 @@ format_float(NODE *arg, struct flags *flags)
while ((nc = snprintf(buf, buflen, cpbuf,
flags->field_width,
(double) tmpval)) >= (int) buflen) {
- erealloc(buf, char *, buflen * 2,
"format_float");
+ erealloc(buf, char *, buflen * 2);
buflen *= 2;
}
}
@@ -1665,12 +1665,12 @@ add_thousands(const char *original)
const char *src;
char *dest;
- emalloc(newbuf, char *, new_len, "add_thousands");
+ emalloc(newbuf, char *, new_len);
memset(newbuf, '\0', new_len);
#if defined(HAVE_LOCALE_H)
new_len = orig_len + (orig_len * strlen(loc.thousands_sep)) + 1;
// worst case
- erealloc(newbuf, char *, new_len, "add_thousands");
+ erealloc(newbuf, char *, new_len);
memset(newbuf, '\0', new_len);
src = original + strlen(original) - 1;
@@ -1734,7 +1734,7 @@ fill_to_field_width(char *startval, struct flags *flags,
int fill)
if (l >= fw) // nothing to do
return startval;
- emalloc(buf, char *, fw + 1, "fill_to_field_width");
+ emalloc(buf, char *, fw + 1);
cp = buf;
if (flags->left_just) {
@@ -1768,7 +1768,7 @@ add_plus_or_space_and_fill(char *number_value, struct
flags *flags)
buflen = flags->field_width + strlen(number_value) +
(flags->space || flags->plus || flags->negative) + 1;
- emalloc(buf1, char *, buflen, "add_plus_or_space_and_fill");
+ emalloc(buf1, char *, buflen);
cp = buf1;
if (flags->left_just) {
@@ -1821,7 +1821,7 @@ zero_fill_to_precision(char *number_value, struct flags
*flags)
buflen = (flags->negative || flags->plus || flags->space) +
flags->precision + 1; // we know val_len < precision
- emalloc(buf1, char *, buflen, "zero_fill_to_precision");
+ emalloc(buf1, char *, buflen);
cp = buf1;
src = number_value;
@@ -1865,7 +1865,7 @@ add_alt_format(char *number_value, struct flags *flags)
buflen = val_len;
buflen += 3;
- emalloc(buf, char *, buflen, "add_alt_format");
+ emalloc(buf, char *, buflen);
cp = buf;
fw = flags->field_width;
diff --git a/profile.c b/profile.c
index 962b8cdc..b4e41996 100644
--- a/profile.c
+++ b/profile.c
@@ -453,7 +453,7 @@ cleanup:
+ indent_level + 1
// indent
+ pc->comment->memory->stlen +
3; // tab comment
- emalloc(str, char *, len, "pprint");
+ emalloc(str, char *, len);
sprintf(str, "%s%s%s%.*s %s", t1->pp_str,
op2str(pc->opcode),
pc->comment->memory->stptr,
(int) (indent_level + 1), tabs,
t2->pp_str);
@@ -1174,7 +1174,7 @@ cleanup:
len = f->pp_len + t->pp_len + cond->pp_len + 12;
if (qm_comment == NULL && colon_comment == NULL) {
// easy case
- emalloc(str, char *, len, "pprint");
+ emalloc(str, char *, len);
sprintf(str, "%s ? %s : %s", cond->pp_str,
t->pp_str, f->pp_str);
} else if (qm_comment != NULL && colon_comment != NULL)
{
check_indent_level();
@@ -1182,7 +1182,7 @@ cleanup:
colon_comment->memory->stlen +
2 * (indent_level + 1) + 3 +
// indentation
t->pp_len + 6;
- emalloc(str, char *, len, "pprint");
+ emalloc(str, char *, len);
sprintf(str,
"%s ? %s" // cond ? comment
"%.*s %s" // indent true-part
@@ -1201,7 +1201,7 @@ cleanup:
len += qm_comment->memory->stlen + //
comment
1 * (indent_level + 1) + 3 + //
indentation
t->pp_len + 3;
- emalloc(str, char *, len, "pprint");
+ emalloc(str, char *, len);
sprintf(str,
"%s ? %s" // cond ? comment
"%.*s %s" // indent true-part
@@ -1217,7 +1217,7 @@ cleanup:
len += colon_comment->memory->stlen +
// comment
1 * (indent_level + 1) + 3 +
// indentation
t->pp_len + 3;
- emalloc(str, char *, len, "pprint");
+ emalloc(str, char *, len);
sprintf(str,
"%s ? %s" // cond ? true-part
" : %s" // : comment
@@ -1645,7 +1645,7 @@ pp_parenthesize(NODE *sp)
if (p[0] == '(') // already parenthesized
return;
- emalloc(p, char *, len + 3, "pp_parenthesize");
+ emalloc(p, char *, len + 3);
*p = '(';
memcpy(p + 1, sp->pp_str, len);
p[len + 1] = ')';
@@ -1718,7 +1718,7 @@ pp_string_or_typed_regex(const char *in_str, size_t len,
int delim, bool typed_r
/* make space for something l big in the buffer */
#define chksize(l) if ((l) > ofre) { \
long olen = obufout - obuf; \
- erealloc(obuf, char *, osiz * 2, "pp_string"); \
+ erealloc(obuf, char *, osiz * 2); \
obufout = obuf + olen; \
ofre += osiz; \
osiz *= 2; \
@@ -1726,7 +1726,7 @@ pp_string_or_typed_regex(const char *in_str, size_t len,
int delim, bool typed_r
/* initial size; 3 for delim + terminating null, 1 for @ */
osiz = len + 3 + 1 + (typed_regex == true);
- emalloc(obuf, char *, osiz, "pp_string");
+ emalloc(obuf, char *, osiz);
obufout = obuf;
ofre = osiz - 1;
@@ -1779,7 +1779,7 @@ pp_number(NODE *n)
char *str;
assert((n->flags & NUMCONSTSTR) != 0);
- emalloc(str, char *, n->stlen + 1, "pp_number");
+ emalloc(str, char *, n->stlen + 1);
strcpy(str, n->stptr);
return str;
}
@@ -1811,10 +1811,10 @@ pp_list(int nargs, const char *paren, const char *delim)
if (pp_args == NULL) {
npp_args = nargs;
- emalloc(pp_args, NODE **, (nargs + 2) * sizeof(NODE *),
"pp_list");
+ emalloc(pp_args, NODE **, (nargs + 2) * sizeof(NODE *));
} else if (nargs > npp_args) {
npp_args = nargs;
- erealloc(pp_args, NODE **, (nargs + 2) * sizeof(NODE *),
"pp_list");
+ erealloc(pp_args, NODE **, (nargs + 2) * sizeof(NODE *));
}
delimlen = strlen(delim);
@@ -1837,7 +1837,7 @@ pp_list(int nargs, const char *paren, const char *delim)
}
comment = NULL;
- emalloc(str, char *, len + 1, "pp_list");
+ emalloc(str, char *, len + 1);
s = str;
if (paren != NULL)
*s++ = paren[0];
@@ -1894,10 +1894,10 @@ pp_concat(int nargs)
if (pp_args == NULL) {
npp_args = nargs;
- emalloc(pp_args, NODE **, (nargs + 2) * sizeof(NODE *),
"pp_concat");
+ emalloc(pp_args, NODE **, (nargs + 2) * sizeof(NODE *));
} else if (nargs > npp_args) {
npp_args = nargs;
- erealloc(pp_args, NODE **, (nargs + 2) * sizeof(NODE *),
"pp_concat");
+ erealloc(pp_args, NODE **, (nargs + 2) * sizeof(NODE *));
}
/*
@@ -1911,7 +1911,7 @@ pp_concat(int nargs)
len += r->pp_len + delimlen + 2;
}
- emalloc(str, char *, len + 1, "pp_concat");
+ emalloc(str, char *, len + 1);
s = str;
/* now copy in */
@@ -1985,7 +1985,7 @@ pp_group3(const char *s1, const char *s2, const char *s3)
len2 = strlen(s2);
len3 = strlen(s3);
l = len1 + len2 + len3 + 1;
- emalloc(str, char *, l, "pp_group3");
+ emalloc(str, char *, l);
s = str;
if (len1 > 0) {
memcpy(s, s1, len1);
@@ -2145,7 +2145,7 @@ adjust_namespace(char *name, bool *malloced)
char *buf;
size_t len = 5 + strlen(name) + 1;
- emalloc(buf, char *, len, "adjust_namespace");
+ emalloc(buf, char *, len);
sprintf(buf, "awk::%s", name);
*malloced = true;
diff --git a/re.c b/re.c
index bfd8d02b..c74b468e 100644
--- a/re.c
+++ b/re.c
@@ -82,10 +82,10 @@ make_regexp(const char *s, size_t len, bool ignorecase,
bool dfa, bool canfatal)
* from that.
*/
if (buf == NULL) {
- emalloc(buf, char *, len + 1, "make_regexp");
+ emalloc(buf, char *, len + 1);
buflen = len;
} else if (len > buflen) {
- erealloc(buf, char *, len + 1, "make_regexp");
+ erealloc(buf, char *, len + 1);
buflen = len;
}
dest = buf;
@@ -261,9 +261,9 @@ make_regexp(const char *s, size_t len, bool ignorecase,
bool dfa, bool canfatal)
*dest = '\0';
len = dest - buf;
- ezalloc(rp, Regexp *, sizeof(*rp), "make_regexp");
+ ezalloc(rp, Regexp *, sizeof(*rp));
rp->pat.allocated = 0; /* regex will allocate the buffer */
- emalloc(rp->pat.fastmap, char *, 256, "make_regexp");
+ emalloc(rp->pat.fastmap, char *, 256);
/*
* Lo these many years ago, had I known what a P.I.T.A. IGNORECASE
diff --git a/str_array.c b/str_array.c
index 1ff8348f..7caa1158 100644
--- a/str_array.c
+++ b/str_array.c
@@ -339,7 +339,7 @@ str_copy(NODE *symbol, NODE *newsymb)
cursize = symbol->array_size;
/* allocate new table */
- ezalloc(new, BUCKET **, cursize * sizeof(BUCKET *), "str_copy");
+ ezalloc(new, BUCKET **, cursize * sizeof(BUCKET *));
old = symbol->buckets;
@@ -412,7 +412,7 @@ str_list(NODE *symbol, NODE *t)
num_elems = 1;
list_size = elem_size * num_elems;
- emalloc(list, NODE **, list_size * sizeof(NODE *), "str_list");
+ emalloc(list, NODE **, list_size * sizeof(NODE *));
/* populate it */
@@ -679,7 +679,7 @@ grow_table(NODE *symbol)
}
/* allocate new table */
- ezalloc(new, BUCKET **, newsize * sizeof(BUCKET *), "grow_table");
+ ezalloc(new, BUCKET **, newsize * sizeof(BUCKET *));
old = symbol->buckets;
symbol->buckets = new;
diff --git a/symbol.c b/symbol.c
index 938c7569..32d30fa1 100644
--- a/symbol.c
+++ b/symbol.c
@@ -97,7 +97,7 @@ init_symbol_table()
init_the_tables();
// save the pointers for the next time.
- emalloc(root_pointers, struct root_pointers *, sizeof(struct
root_pointers), "init_symbol_table");
+ emalloc(root_pointers, struct root_pointers *, sizeof(struct
root_pointers));
memset(root_pointers, 0, sizeof(struct root_pointers));
root_pointers->global_table = global_table;
root_pointers->func_table = func_table;
@@ -215,7 +215,7 @@ make_params(char **pnames, int pcount)
if (pcount <= 0 || pnames == NULL)
return NULL;
- ezalloc(parms, NODE *, pcount * sizeof(NODE), "make_params");
+ ezalloc(parms, NODE *, pcount * sizeof(NODE));
for (i = 0, p = parms; i < pcount; i++, p++) {
p->type = Node_param_list;
@@ -480,7 +480,7 @@ get_symbols(SYMBOL_TYPE what, bool sort)
max = the_table->table_size * 2;
list = assoc_list(the_table, "@unsorted", ASORTI);
- emalloc(table, NODE **, (the_table->table_size + 1) *
sizeof(NODE *), "get_symbols");
+ emalloc(table, NODE **, (the_table->table_size + 1) *
sizeof(NODE *));
for (i = count = 0; i < max; i += 2) {
r = list[i+1];
@@ -497,7 +497,7 @@ get_symbols(SYMBOL_TYPE what, bool sort)
list = assoc_list(the_table, "@unsorted", ASORTI);
/* add three: one for FUNCTAB, one for SYMTAB, and one for a
final NULL */
- emalloc(table, NODE **, (the_table->table_size + 1 + 1 + 1) *
sizeof(NODE *), "get_symbols");
+ emalloc(table, NODE **, (the_table->table_size + 1 + 1 + 1) *
sizeof(NODE *));
for (i = count = 0; i < max; i += 2) {
r = list[i+1];
@@ -834,7 +834,7 @@ bcalloc(OPCODE op, int size, int srcline)
pool->free_space += size;
} else {
struct instruction_block *block;
- emalloc(block, struct instruction_block *, sizeof(struct
instruction_block), "bcalloc");
+ emalloc(block, struct instruction_block *, sizeof(struct
instruction_block));
block->next = pool->block_list;
pool->block_list = block;
cp = &block->i[0];
@@ -855,7 +855,7 @@ new_context()
{
AWK_CONTEXT *ctxt;
- ezalloc(ctxt, AWK_CONTEXT *, sizeof(AWK_CONTEXT), "new_context");
+ ezalloc(ctxt, AWK_CONTEXT *, sizeof(AWK_CONTEXT));
ctxt->srcfiles.next = ctxt->srcfiles.prev = & ctxt->srcfiles;
ctxt->rule_list.opcode = Op_list;
ctxt->rule_list.lasti = & ctxt->rule_list;
diff --git a/vms/ChangeLog b/vms/ChangeLog
index 1d2b0e0d..228ae998 100644
--- a/vms/ChangeLog
+++ b/vms/ChangeLog
@@ -1,3 +1,7 @@
+2024-12-15 Arnold D. Robbins <arnold@skeeve.com>
+
+ * vms_misc.c, vms_popen.c: Adjust calls of emalloc().
+
2024-09-17 Arnold D. Robbins <arnold@skeeve.com>
* 5.3.1: Release tar made.
diff --git a/vms/vms_misc.c b/vms/vms_misc.c
index 2c81d79f..d5ba1d0d 100644
--- a/vms/vms_misc.c
+++ b/vms/vms_misc.c
@@ -59,7 +59,7 @@ vms_strdup( const char *str )
char *result;
int len = strlen(str);
- emalloc(result, char *, len+1, "strdup");
+ emalloc(result, char *, len+1);
return strcpy(result, str);
}
diff --git a/vms/vms_popen.c b/vms/vms_popen.c
index 5f4736d1..a636e244 100644
--- a/vms/vms_popen.c
+++ b/vms/vms_popen.c
@@ -86,7 +86,7 @@ static int pipes_lim = 0;
#define psize(n) ((n) * sizeof(PIPE))
#define expand_pipes(k) do { PIPE *new_p; \
int new_p_lim = ((k) / _NFILE + 1) * _NFILE; \
- emalloc(new_p, PIPE *, psize(new_p_lim), "expand_pipes"); \
+ emalloc(new_p, PIPE *, psize(new_p_lim)); \
if (pipes_lim > 0) \
memcpy(new_p, pipes, psize(pipes_lim)), free(pipes); \
memset(new_p + psize(pipes_lim), 0, psize(new_p_lim - pipes_lim)); \
@@ -287,11 +287,11 @@ save_translation( const struct dsc$descriptor_s *logname )
use three entries for each translation.
*/
itmlst_size = (3 * (max_trans_indx + 1) + 1) * sizeof(Itm);
- emalloc(itmlst, Itm *, itmlst_size, "save_translation");
+ emalloc(itmlst, Itm *, itmlst_size);
for (i = 0; i <= max_trans_indx; i++) {
struct def { U_Long indx, attr; U_Short len;
char str[LNM$C_NAMLENGTH], eos; } *wrk;
- emalloc(wrk, struct def *, sizeof (struct def), "save_translation");
+ emalloc(wrk, struct def *, sizeof (struct def));
wrk->indx = (U_Long)i; /* this one's an input value for $trnlnm */
SetItmS(itmlst[3*i+0], LNM$_INDEX, &wrk->indx);
SetItmS(itmlst[3*i+1], LNM$_ATTRIBUTES, &wrk->attr), wrk->attr = 0;
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 7 +++++++
array.c | 16 ++++++++--------
awk.h | 12 ++++++------
awkgram.c | 38 +++++++++++++++++++-------------------
awkgram.y | 38 +++++++++++++++++++-------------------
builtin.c | 20 ++++++++++----------
cint_array.c | 16 ++++++++--------
command.c | 14 +++++++-------
command.y | 14 +++++++-------
debug.c | 50 +++++++++++++++++++++++++-------------------------
eval.c | 20 ++++++++++----------
ext.c | 2 +-
field.c | 24 ++++++++++++------------
gawkapi.c | 17 ++++++++---------
int_array.c | 8 ++++----
interpret.h | 7 +++----
io.c | 30 ++++++++++++++----------------
main.c | 14 ++++++--------
mpfr.c | 4 ++--
node.c | 22 +++++++++++-----------
printf.c | 44 ++++++++++++++++++++++----------------------
profile.c | 34 +++++++++++++++++-----------------
re.c | 8 ++++----
str_array.c | 6 +++---
symbol.c | 12 ++++++------
vms/ChangeLog | 4 ++++
vms/vms_misc.c | 2 +-
vms/vms_popen.c | 6 +++---
28 files changed, 247 insertions(+), 242 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5585-g81eb4297,
Arnold Robbins <=