mirror of
https://github.com/ThomasDickey/mawk-snapshots.git
synced 2026-01-26 19:09:15 +00:00
snapshot of project "mawk", label t20241214
This commit is contained in:
parent
c978ff1677
commit
9d0711d4f8
5
CHANGES
5
CHANGES
@ -1,4 +1,7 @@
|
||||
-- $MawkId: CHANGES,v 1.411 2024/12/14 01:09:36 tom Exp $
|
||||
-- $MawkId: CHANGES,v 1.412 2024/12/14 17:00:30 tom Exp $
|
||||
|
||||
20241214
|
||||
+ fix stricter gcc15 warnings.
|
||||
|
||||
20241213
|
||||
+ disallow reading from a directory like a file (Original-Mawk #83).
|
||||
|
||||
2
MANIFEST
2
MANIFEST
@ -1,4 +1,4 @@
|
||||
MANIFEST for mawk, version t20241213
|
||||
MANIFEST for mawk, version t20241214
|
||||
--------------------------------------------------------------------------------
|
||||
MANIFEST this file
|
||||
ACKNOWLEDGMENT acknowledgements
|
||||
|
||||
23
aclocal.m4
vendored
23
aclocal.m4
vendored
@ -1,4 +1,4 @@
|
||||
dnl $MawkId: aclocal.m4,v 1.117 2024/11/17 10:14:05 tom Exp $
|
||||
dnl $MawkId: aclocal.m4,v 1.119 2024/12/14 16:59:38 tom Exp $
|
||||
dnl custom mawk macros for autoconf
|
||||
dnl
|
||||
dnl The symbols beginning "CF_MAWK_" were originally written by Mike Brennan,
|
||||
@ -250,7 +250,7 @@ ifelse([$3],,[ :]dnl
|
||||
])dnl
|
||||
])])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_BUILD_CC version: 13 updated: 2024/06/22 13:42:22
|
||||
dnl CF_BUILD_CC version: 14 updated: 2024/12/14 11:58:01
|
||||
dnl -----------
|
||||
dnl If we're cross-compiling, allow the user to override the tools and their
|
||||
dnl options. The configure script is oriented toward identifying the host
|
||||
@ -328,7 +328,7 @@ if test "$cross_compiling" = yes ; then
|
||||
AC_TRY_RUN([#include <stdio.h>
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
${cf_cv_main_return:-return}(argc < 0 || argv == 0 || argv[0] == 0);
|
||||
${cf_cv_main_return:-return}(argc < 0 || argv == (void*)0 || argv[0] == (void*)0);
|
||||
}
|
||||
],
|
||||
cf_ok_build_cc=yes,
|
||||
@ -623,7 +623,7 @@ if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then
|
||||
fi
|
||||
])
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_CONST_X_STRING version: 8 updated: 2023/12/01 17:22:50
|
||||
dnl CF_CONST_X_STRING version: 9 updated: 2024/12/04 03:49:57
|
||||
dnl -----------------
|
||||
dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most
|
||||
dnl character-strings.
|
||||
@ -650,7 +650,7 @@ CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING])
|
||||
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include <stdlib.h>
|
||||
$ac_includes_default
|
||||
#include <X11/Intrinsic.h>
|
||||
],
|
||||
[String foo = malloc(1); free((void*)foo)],[
|
||||
@ -661,7 +661,7 @@ AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[
|
||||
#undef _CONST_X_STRING
|
||||
#define _CONST_X_STRING /* X11R7.8 (perhaps) */
|
||||
#undef XTSTRINGDEFINES /* X11R5 and later */
|
||||
#include <stdlib.h>
|
||||
$ac_includes_default
|
||||
#include <X11/Intrinsic.h>
|
||||
],[String foo = malloc(1); *foo = 0],[
|
||||
cf_cv_const_x_string=no
|
||||
@ -1005,7 +1005,7 @@ CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
|
||||
CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_GCC_WARNINGS version: 41 updated: 2021/01/01 16:53:59
|
||||
dnl CF_GCC_WARNINGS version: 42 updated: 2024/12/14 09:09:41
|
||||
dnl ---------------
|
||||
dnl Check if the compiler supports useful warning options. There's a few that
|
||||
dnl we don't use, simply because they're too noisy:
|
||||
@ -1031,7 +1031,7 @@ AC_REQUIRE([CF_GCC_VERSION])
|
||||
if test "x$have_x" = xyes; then CF_CONST_X_STRING fi
|
||||
cat > "conftest.$ac_ext" <<EOF
|
||||
#line __oline__ "${as_me:-configure}"
|
||||
int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
|
||||
int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == (void*)0) ; }
|
||||
EOF
|
||||
if test "$INTEL_COMPILER" = yes
|
||||
then
|
||||
@ -2133,14 +2133,17 @@ AC_SUBST(GROFF_NOTE)
|
||||
AC_SUBST(NROFF_NOTE)
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_PROG_LINT version: 5 updated: 2022/08/20 15:44:13
|
||||
dnl CF_PROG_LINT version: 7 updated: 2024/11/30 14:37:45
|
||||
dnl ------------
|
||||
AC_DEFUN([CF_PROG_LINT],
|
||||
[
|
||||
AC_CHECK_PROGS(LINT, lint cppcheck splint)
|
||||
case "x$LINT" in
|
||||
(xlint|x*/lint) # NetBSD 10
|
||||
test -z "$LINT_OPTS" && LINT_OPTS="-chapbrxzgFS -v -Ac11"
|
||||
;;
|
||||
(xcppcheck|x*/cppcheck)
|
||||
test -z "$LINT_OPTS" && LINT_OPTS="--enable=all"
|
||||
test -z "$LINT_OPTS" && LINT_OPTS="--enable=all -D__CPPCHECK__"
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(LINT_OPTS)
|
||||
|
||||
10
array.c
10
array.c
@ -1,6 +1,6 @@
|
||||
/* array.c */
|
||||
/*
|
||||
$MawkId: array.c,v 1.29 2024/08/25 18:28:02 tom Exp $
|
||||
$MawkId: array.c,v 1.30 2024/12/14 12:53:14 tom Exp $
|
||||
|
||||
copyright 2009-2023,2024 Thomas E. Dickey
|
||||
copyright 1991-1996,2014 Michael D. Brennan
|
||||
@ -13,8 +13,8 @@ the GNU General Public License, version 2, 1991.
|
||||
|
||||
array.c and array.h were originally generated with the commands
|
||||
|
||||
notangle -R'"array.c"' array.w > array.c
|
||||
notangle -R'"array.h"' array.w > array.h
|
||||
notangle -R'"array.c"' array.w > array.c
|
||||
notangle -R'"array.h"' array.w > array.h
|
||||
|
||||
Notangle is part of Norman Ramsey's noweb literate programming package
|
||||
available from CTAN(ftp.shsu.edu).
|
||||
@ -136,7 +136,7 @@ array_delete(
|
||||
DUAL_LINK *table = (DUAL_LINK *) A->ptr;
|
||||
table[(unsigned) ap->ival & A->hmask].ilink = ap->ilink;
|
||||
if (ap->sval) {
|
||||
ANODE *p, *q = 0;
|
||||
ANODE *p, *q = NULL;
|
||||
unsigned indx = (unsigned) ap->hval & A->hmask;
|
||||
p = table[indx].slink;
|
||||
while (p != ap) {
|
||||
@ -180,7 +180,7 @@ array_delete(
|
||||
DUAL_LINK *table = (DUAL_LINK *) A->ptr;
|
||||
table[ap->hval & A->hmask].slink = ap->slink;
|
||||
if (ap->ival != NOT_AN_IVALUE) {
|
||||
ANODE *p, *q = 0;
|
||||
ANODE *p, *q = NULL;
|
||||
unsigned indx = (unsigned) ap->ival & A->hmask;
|
||||
p = table[indx].ilink;
|
||||
while (p != ap) {
|
||||
|
||||
6
array.h
6
array.h
@ -1,6 +1,6 @@
|
||||
/* array.h */
|
||||
/*
|
||||
$MawkId: array.h,v 1.23 2024/08/25 18:31:19 tom Exp $
|
||||
$MawkId: array.h,v 1.24 2024/12/14 12:49:15 tom Exp $
|
||||
|
||||
copyright 2009-2020,2024 Thomas E. Dickey
|
||||
copyright 1991-1996,2014 Michael D. Brennan
|
||||
@ -13,8 +13,8 @@ the GNU General Public License, version 2, 1991.
|
||||
|
||||
array.c and array.h were originally generated with the commands
|
||||
|
||||
notangle -R'"array.c"' array.w > array.c
|
||||
notangle -R'"array.h"' array.w > array.h
|
||||
notangle -R'"array.c"' array.w > array.c
|
||||
notangle -R'"array.h"' array.w > array.h
|
||||
|
||||
Notangle is part of Norman Ramsey's noweb literate programming package
|
||||
available from CTAN(ftp.shsu.edu).
|
||||
|
||||
20
bi_funct.c
20
bi_funct.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: bi_funct.c,v 1.139 2024/11/18 00:06:50 tom Exp $
|
||||
* $MawkId: bi_funct.c,v 1.140 2024/12/14 12:53:14 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_ARRAY
|
||||
@ -163,7 +163,7 @@ str_str(char *target, size_t target_len, const char *key, size_t key_len)
|
||||
register int k = key[0];
|
||||
int k1;
|
||||
const char *prior;
|
||||
char *result = 0;
|
||||
char *result = NULL;
|
||||
|
||||
switch (key_len) {
|
||||
case 0:
|
||||
@ -469,7 +469,7 @@ bi_strftime(CELL *sp)
|
||||
struct tm *ptm;
|
||||
int n_args;
|
||||
int utc;
|
||||
STRING *sval = 0; /* strftime(sval->str, timestamp, utc) */
|
||||
STRING *sval = NULL; /* strftime(sval->str, timestamp, utc) */
|
||||
size_t result;
|
||||
|
||||
TRACE_FUNC("bi_strftime", sp);
|
||||
@ -781,7 +781,7 @@ bi_srand(CELL *sp)
|
||||
#ifdef USE_SYSTEM_SRAND
|
||||
static CELL cseed =
|
||||
{
|
||||
C_DOUBLE, 0, 0, 1.0
|
||||
C_DOUBLE, 0, NULL, 1.0
|
||||
};
|
||||
double seed32;
|
||||
#endif
|
||||
@ -949,8 +949,8 @@ CELL *
|
||||
bi_getline(CELL *sp)
|
||||
{
|
||||
CELL tc;
|
||||
CELL *cp = 0;
|
||||
char *p = 0;
|
||||
CELL *cp = NULL;
|
||||
char *p = NULL;
|
||||
size_t len = 0;
|
||||
FIN *fin_p;
|
||||
|
||||
@ -1085,7 +1085,7 @@ bi_sub(CELL *sp)
|
||||
&middle_len,
|
||||
0);
|
||||
|
||||
if (middle != 0) {
|
||||
if (middle != NULL) {
|
||||
size_t front_len = (size_t) (middle - front);
|
||||
char *back = middle + middle_len;
|
||||
size_t back_len = string(&sc)->len - front_len - middle_len;
|
||||
@ -1173,7 +1173,7 @@ gsub3(PTR re, CELL *repl, CELL *target)
|
||||
* that can be an empty string, e.g., for "*" or "?". The length
|
||||
* is in 'howmuch'.
|
||||
*/
|
||||
if (where != 0) {
|
||||
if (where != NULL) {
|
||||
have = (size_t) (where - (input->str + j));
|
||||
if (have) {
|
||||
skip0 = -1;
|
||||
@ -1189,11 +1189,11 @@ gsub3(PTR re, CELL *repl, CELL *target)
|
||||
TRACE(("\n"));
|
||||
|
||||
if (repl->type == C_REPLV) {
|
||||
if (xrepl.ptr == 0 ||
|
||||
if (xrepl.ptr == NULL ||
|
||||
string(&xrepl)->len != howmuch ||
|
||||
(howmuch != 0 &&
|
||||
memcmp(string(&xrepl)->str, where, howmuch))) {
|
||||
if (xrepl.ptr != 0)
|
||||
if (xrepl.ptr != NULL)
|
||||
repl_destroy(&xrepl);
|
||||
sval = new_STRING1(where, howmuch);
|
||||
cellcpy(&xrepl, repl);
|
||||
|
||||
4
cast.c
4
cast.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: cast.c,v 1.34 2024/12/13 00:20:03 tom Exp $
|
||||
* $MawkId: cast.c,v 1.35 2024/12/14 21:21:20 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_CELL
|
||||
@ -512,7 +512,7 @@ no_leaks_cell_ptr(CELL *cp)
|
||||
void
|
||||
cell_leaks(void)
|
||||
{
|
||||
while (all_cells != 0) {
|
||||
while (all_cells != NULL) {
|
||||
ALL_CELLS *next = all_cells->next;
|
||||
if (all_cells->ptr) {
|
||||
zfree(all_cells->cp, sizeof(CELL));
|
||||
|
||||
22
code.c
22
code.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: code.c,v 1.48 2024/09/05 17:44:48 tom Exp $
|
||||
* $MawkId: code.c,v 1.50 2024/12/14 21:21:20 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_CELL
|
||||
@ -38,7 +38,7 @@ CODEBLOCK *main_code_p, *begin_code_p, *end_code_p;
|
||||
INST *begin_start, *main_start, *end_start;
|
||||
size_t begin_size, main_size, end_size;
|
||||
|
||||
INST *execution_start = 0;
|
||||
INST *execution_start = NULL;
|
||||
|
||||
/* grow the active code */
|
||||
void
|
||||
@ -157,7 +157,7 @@ set_code(void)
|
||||
execution_start = main_start;
|
||||
} else { /* only BEGIN */
|
||||
zfree(code_base, INST_BYTES(PAGESZ));
|
||||
code_base = 0;
|
||||
code_base = NULL;
|
||||
ZFREE(main_code_p);
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@ free_codes(const char *tag, INST * base, size_t size)
|
||||
(void *) base,
|
||||
(unsigned long) size));
|
||||
|
||||
if (base != 0 && size != 0) {
|
||||
if (base != NULL && size != 0) {
|
||||
for (cdp = base; cdp < last; ++cdp) {
|
||||
#ifndef NO_LEAKS
|
||||
TRACE_INST(cdp, base);
|
||||
@ -303,7 +303,7 @@ free_codes(const char *tag, INST * base, size_t size)
|
||||
case AE_PUSHI:
|
||||
++cdp; /* skip pointer */
|
||||
cp = (CELL *) (cdp->ptr);
|
||||
if (cp != 0) {
|
||||
if (cp != NULL) {
|
||||
free_cell_data(cp);
|
||||
}
|
||||
break;
|
||||
@ -432,19 +432,19 @@ void
|
||||
code_leaks(void)
|
||||
{
|
||||
TRACE(("code_leaks\n"));
|
||||
if (begin_start != 0) {
|
||||
if (begin_start != NULL) {
|
||||
free_codes("BEGIN", begin_start, begin_size);
|
||||
begin_start = 0;
|
||||
begin_start = NULL;
|
||||
begin_size = 0;
|
||||
}
|
||||
if (end_start != 0) {
|
||||
if (end_start != NULL) {
|
||||
free_codes("END", end_start, end_size);
|
||||
end_start = 0;
|
||||
end_start = NULL;
|
||||
end_size = 0;
|
||||
}
|
||||
if (main_start != 0) {
|
||||
if (main_start != NULL) {
|
||||
free_codes("MAIN", main_start, main_size);
|
||||
main_start = 0;
|
||||
main_start = NULL;
|
||||
main_size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
8
da.c
8
da.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: da.c,v 1.53 2024/09/05 17:44:48 tom Exp $
|
||||
* $MawkId: da.c,v 1.54 2024/12/14 12:53:14 tom Exp $
|
||||
*/
|
||||
|
||||
/* disassemble code */
|
||||
@ -610,7 +610,7 @@ const char *
|
||||
da_op_name(const INST * cdp)
|
||||
{
|
||||
int n;
|
||||
const char *result = 0;
|
||||
const char *result = NULL;
|
||||
|
||||
if (cdp->op == _BUILTIN) {
|
||||
result = find_bi_name(cdp[1].fnc);
|
||||
@ -627,7 +627,7 @@ da_op_name(const INST * cdp)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (result == 0) {
|
||||
if (result == NULL) {
|
||||
for (n = 0; other_codes[n].op != _HALT; ++n) {
|
||||
if (other_codes[n].op == cdp->op) {
|
||||
result = other_codes[n].name;
|
||||
@ -635,7 +635,7 @@ da_op_name(const INST * cdp)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result == 0) {
|
||||
if (result == NULL) {
|
||||
result = "bad instruction";
|
||||
}
|
||||
}
|
||||
|
||||
6
error.c
6
error.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: error.c,v 1.30 2024/12/13 23:40:55 tom Exp $
|
||||
* $MawkId: error.c,v 1.31 2024/12/14 12:53:14 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_CELL
|
||||
@ -118,7 +118,7 @@ missing(int c, const char *n, unsigned ln)
|
||||
void
|
||||
yyerror(const char *s GCC_UNUSED)
|
||||
{
|
||||
const char *ss = 0;
|
||||
const char *ss = NULL;
|
||||
const struct token_str *p;
|
||||
const int *ip;
|
||||
|
||||
@ -299,7 +299,7 @@ unexpected_char(void)
|
||||
const char *
|
||||
type_to_str(int type)
|
||||
{
|
||||
const char *retval = 0;
|
||||
const char *retval = NULL;
|
||||
|
||||
switch (type) {
|
||||
case ST_NONE:
|
||||
|
||||
26
execute.c
26
execute.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: execute.c,v 1.63 2024/11/11 21:02:23 tom Exp $
|
||||
* $MawkId: execute.c,v 1.64 2024/12/14 12:53:14 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_ARRAY
|
||||
@ -137,8 +137,8 @@ execute(INST * cdp, /* code ptr, start execution here */
|
||||
ALOOP_STATE *aloop_state = (ALOOP_STATE *) 0;
|
||||
|
||||
/* for moving the eval stack on deep recursion */
|
||||
CELL *old_stack_base = 0;
|
||||
CELL *old_sp = 0;
|
||||
CELL *old_stack_base = NULL;
|
||||
CELL *old_sp = NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
CELL *entry_sp;
|
||||
@ -350,7 +350,7 @@ execute(INST * cdp, /* code ptr, start execution here */
|
||||
has an ARRAY in the ptr field, replace expr
|
||||
with array[expr]
|
||||
*/
|
||||
if (fp != 0) {
|
||||
if (fp != NULL) {
|
||||
cp = array_find((ARRAY) fp[(cdp++)->op].ptr, sp, CREATE);
|
||||
cell_destroy(sp);
|
||||
cellcpy(sp, cp);
|
||||
@ -363,7 +363,7 @@ execute(INST * cdp, /* code ptr, start execution here */
|
||||
has an ARRAY in the ptr field, replace expr
|
||||
with & array[expr]
|
||||
*/
|
||||
if (fp != 0) {
|
||||
if (fp != NULL) {
|
||||
cp = array_find((ARRAY) fp[(cdp++)->op].ptr, sp, CREATE);
|
||||
cell_destroy(sp);
|
||||
sp->ptr = (PTR) cp;
|
||||
@ -375,7 +375,7 @@ execute(INST * cdp, /* code ptr, start execution here */
|
||||
has an ARRAY in the ptr field. Push this ARRAY
|
||||
on the eval stack
|
||||
*/
|
||||
if (fp != 0) {
|
||||
if (fp != NULL) {
|
||||
inc_sp();
|
||||
sp->ptr = fp[(cdp++)->op].ptr;
|
||||
}
|
||||
@ -464,7 +464,7 @@ execute(INST * cdp, /* code ptr, start execution here */
|
||||
case ALOOP:
|
||||
{
|
||||
ALOOP_STATE *ap = aloop_state;
|
||||
if (ap != 0 && (ap->ptr < ap->limit)) {
|
||||
if (ap != NULL && (ap->ptr < ap->limit)) {
|
||||
cell_destroy(ap->var);
|
||||
ap->var->type = C_STRING;
|
||||
ap->var->ptr = (PTR) * ap->ptr++;
|
||||
@ -479,7 +479,7 @@ execute(INST * cdp, /* code ptr, start execution here */
|
||||
{
|
||||
/* finish up an array loop */
|
||||
ALOOP_STATE *ap = aloop_state;
|
||||
if (ap != 0) {
|
||||
if (ap != NULL) {
|
||||
aloop_state = ap->link;
|
||||
while (ap->ptr < ap->limit) {
|
||||
free_STRING(*ap->ptr);
|
||||
@ -1170,12 +1170,12 @@ execute(INST * cdp, /* code ptr, start execution here */
|
||||
|
||||
if (begin_start) {
|
||||
free_codes("BEGIN", begin_start, begin_size);
|
||||
begin_start = 0;
|
||||
begin_start = NULL;
|
||||
begin_size = 0;
|
||||
}
|
||||
if (main_start) {
|
||||
free_codes("MAIN", main_start, main_size);
|
||||
main_start = 0;
|
||||
main_start = NULL;
|
||||
main_size = 0;
|
||||
}
|
||||
sp = stack_under; /* might be in user function */
|
||||
@ -1184,7 +1184,7 @@ execute(INST * cdp, /* code ptr, start execution here */
|
||||
|
||||
case _JMAIN: /* go from BEGIN code to MAIN code */
|
||||
free_codes("BEGIN", begin_start, begin_size);
|
||||
begin_start = 0;
|
||||
begin_start = NULL;
|
||||
begin_size = 0;
|
||||
cdp = main_start;
|
||||
break;
|
||||
@ -1339,7 +1339,7 @@ execute(INST * cdp, /* code ptr, start execution here */
|
||||
int a_args = (cdp++)->op; /* actual number of args */
|
||||
CELL *nfp = sp - a_args + 1; /* new fp for callee */
|
||||
CELL *local_p = sp + 1; /* first local argument on stack */
|
||||
SYM_TYPE *type_p = 0; /* pts to type of an argument */
|
||||
SYM_TYPE *type_p = NULL; /* pts to type of an argument */
|
||||
|
||||
if (fbp->nargs) {
|
||||
type_p = fbp->typev + a_args - 1;
|
||||
@ -1362,7 +1362,7 @@ execute(INST * cdp, /* code ptr, start execution here */
|
||||
|
||||
/* cleanup the callee's arguments */
|
||||
/* putting return value at top of eval stack */
|
||||
if ((type_p != 0) && (sp >= nfp)) {
|
||||
if ((type_p != NULL) && (sp >= nfp)) {
|
||||
cp = sp + 1; /* cp -> the function return */
|
||||
|
||||
do {
|
||||
|
||||
6
fcall.c
6
fcall.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: fcall.c,v 1.23 2024/08/25 19:33:50 tom Exp $
|
||||
* $MawkId: fcall.c,v 1.24 2024/12/14 12:57:40 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_ARRAY
|
||||
@ -43,7 +43,7 @@ trace_arg_list(CA_REC * arg_list)
|
||||
CA_REC *item;
|
||||
int count = 0;
|
||||
TRACE(("trace_arg_list\n"));
|
||||
while ((item = arg_list) != 0) {
|
||||
while ((item = arg_list) != NULL) {
|
||||
arg_list = item->link;
|
||||
TRACE(("...arg %d is %s\n", item->arg_num + 1, type_to_str(item->type)));
|
||||
++count;
|
||||
@ -63,7 +63,7 @@ static int
|
||||
inst_len(INST * p)
|
||||
{
|
||||
int result = 0;
|
||||
while (p != 0 && p->op != _HALT) {
|
||||
while (p != NULL && p->op != _HALT) {
|
||||
++result;
|
||||
switch ((MAWK_OPCODES) (p++->op)) {
|
||||
case _HALT:
|
||||
|
||||
12
field.c
12
field.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: field.c,v 1.49 2024/11/20 00:05:54 tom Exp $
|
||||
* $MawkId: field.c,v 1.51 2024/12/14 21:21:20 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_CELL
|
||||
@ -97,7 +97,7 @@ SEPARATOR rs_shadow =
|
||||
/* a splitting CELL version of FS */
|
||||
CELL fs_shadow =
|
||||
{
|
||||
C_SPACE, 0, 0, 0.0
|
||||
C_SPACE, 0, NULL, 0.0
|
||||
};
|
||||
int nf;
|
||||
/* nf holds the true value of NF. If nf < 0 , then
|
||||
@ -625,7 +625,7 @@ slow_cell_assign(CELL *target, CELL *source)
|
||||
CELL *bank_start = fbankv[i];
|
||||
CELL *bank_end;
|
||||
|
||||
if (bank_start == 0)
|
||||
if (bank_start == NULL)
|
||||
break;
|
||||
|
||||
bank_end = bank_start + FBANK_SZ;
|
||||
@ -671,7 +671,7 @@ slow_field_ptr(int i)
|
||||
|
||||
j = (max_field >> FB_SHIFT) + 1;
|
||||
|
||||
assert(j > 0 && fbankv[j - 1] != 0 && fbankv[j] == 0);
|
||||
assert(j > 0 && fbankv[j - 1] != NULL && fbankv[j] == NULL);
|
||||
|
||||
do {
|
||||
fbankv[j] = (CELL *) zmalloc(sizeof(CELL) * FBANK_SZ);
|
||||
@ -742,12 +742,12 @@ fbankv_free(void)
|
||||
{
|
||||
unsigned i = 1;
|
||||
const size_t cnt = FBANKV_CHUNK_SIZE * fbankv_num_chunks;
|
||||
while (i < cnt && fbankv[i] != 0) {
|
||||
while (i < cnt && fbankv[i] != NULL) {
|
||||
fbank_free(fbankv[i]);
|
||||
i++;
|
||||
}
|
||||
for (; i < cnt; i++) {
|
||||
if (fbankv[i] != 0) {
|
||||
if (fbankv[i] != NULL) {
|
||||
bozo("unexpected pointer in fbankv[]");
|
||||
}
|
||||
}
|
||||
|
||||
20
files.c
20
files.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: files.c,v 1.40 2024/12/14 01:35:10 tom Exp $
|
||||
* $MawkId: files.c,v 1.42 2024/12/14 19:34:27 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_STRING
|
||||
@ -79,10 +79,10 @@ alloc_filenode(void)
|
||||
result = ZMALLOC(FILE_NODE);
|
||||
|
||||
#ifdef NO_LEAKS
|
||||
result->name = 0;
|
||||
result->name = NULL;
|
||||
#endif
|
||||
|
||||
result->ptr = 0;
|
||||
result->ptr = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ static void
|
||||
free_filenode(FILE_NODE * p)
|
||||
{
|
||||
#ifdef NO_LEAKS
|
||||
if (p->name != 0) {
|
||||
if (p->name != NULL) {
|
||||
free_STRING(p->name);
|
||||
}
|
||||
#endif
|
||||
@ -195,7 +195,7 @@ file_find(STRING * sval, int type)
|
||||
|
||||
/* search is by name and type */
|
||||
if (strcmp(name, p->name->str) == 0 &&
|
||||
(p->ptr != 0) &&
|
||||
(p->ptr != NULL) &&
|
||||
(p->type == type ||
|
||||
/* no distinction between F_APPEND and F_TRUNC here */
|
||||
(p->type >= F_APPEND && type >= F_APPEND))) {
|
||||
@ -225,7 +225,7 @@ int
|
||||
file_close(STRING * sval)
|
||||
{
|
||||
FILE_NODE *p;
|
||||
FILE_NODE *q = 0; /* trails p */
|
||||
FILE_NODE *q = NULL; /* trails p */
|
||||
FILE_NODE *hold;
|
||||
char *name = sval->str;
|
||||
int retval = -1;
|
||||
@ -242,7 +242,7 @@ file_close(STRING * sval)
|
||||
Note that we don't have to consider the list corruption
|
||||
caused by a recursive call because it will never return. */
|
||||
|
||||
if (q == 0)
|
||||
if (q == NULL)
|
||||
file_list = p->link;
|
||||
else
|
||||
q->link = p->link;
|
||||
@ -376,7 +376,7 @@ void
|
||||
close_out_pipes(void)
|
||||
{
|
||||
FILE_NODE *p = file_list;
|
||||
FILE_NODE *q = 0;
|
||||
FILE_NODE *q = NULL;
|
||||
|
||||
while (p) {
|
||||
|
||||
@ -385,7 +385,7 @@ close_out_pipes(void)
|
||||
/* if another error occurs we do not want to be called
|
||||
for the same file again */
|
||||
|
||||
if (q != 0)
|
||||
if (q != NULL)
|
||||
q->link = p->link;
|
||||
else
|
||||
file_list = p->link;
|
||||
@ -705,7 +705,7 @@ void
|
||||
files_leaks(void)
|
||||
{
|
||||
TRACE(("files_leaks\n"));
|
||||
while (file_list != 0) {
|
||||
while (file_list != NULL) {
|
||||
FILE_NODE *p = file_list;
|
||||
file_list = p->link;
|
||||
free_filenode(p);
|
||||
|
||||
16
fin.c
16
fin.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: fin.c,v 1.60 2024/12/14 01:35:23 tom Exp $
|
||||
* $MawkId: fin.c,v 1.62 2024/12/14 21:21:20 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_CELL
|
||||
@ -112,7 +112,7 @@ FINdopen(int fd, int main_flag)
|
||||
FIN *
|
||||
FINopen(char *filename, int main_flag)
|
||||
{
|
||||
FIN *result = 0;
|
||||
FIN *result = NULL;
|
||||
int fd;
|
||||
int oflag = O_RDONLY;
|
||||
|
||||
@ -187,7 +187,7 @@ char *
|
||||
FINgets(FIN * fin, size_t *len_p)
|
||||
{
|
||||
char *p;
|
||||
char *q = 0;
|
||||
char *q = NULL;
|
||||
size_t match_len;
|
||||
size_t r;
|
||||
|
||||
@ -355,7 +355,7 @@ FINgets(FIN * fin, size_t *len_p)
|
||||
r = amount;
|
||||
if (fin->buff_size < r) {
|
||||
fin->flags |= EOF_FLAG;
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = (char *) memmove(fin->buff, p, r);
|
||||
@ -394,7 +394,7 @@ enlarge_fin_buffer(FIN * fin)
|
||||
fin->buffp =
|
||||
fin->buff = (char *) zrealloc(fin->buff, oldsize, newsize);
|
||||
|
||||
if (fin->fp == 0) {
|
||||
if (fin->fp == NULL) {
|
||||
r = fillbuff(fin->fd, fin->buff + oldsize, extra);
|
||||
if (r < extra)
|
||||
fin->flags |= EOF_FLAG;
|
||||
@ -493,7 +493,7 @@ next_main(int open_flag) /* called by open_main() if on */
|
||||
|
||||
if (main_fin) {
|
||||
FINclose(main_fin);
|
||||
main_fin = 0;
|
||||
main_fin = NULL;
|
||||
}
|
||||
/* FILENAME and FNR don't change unless we really open
|
||||
a new file */
|
||||
@ -571,7 +571,7 @@ is_cmdline_assign(char *s)
|
||||
|
||||
int c;
|
||||
SYMTAB *stp;
|
||||
CELL *cp = 0;
|
||||
CELL *cp = NULL;
|
||||
size_t len;
|
||||
CELL cell = empty_cell; /* used if command line assign to pseudo field */
|
||||
CELL *fp = NULL; /* ditto */
|
||||
@ -638,7 +638,7 @@ fin_leaks(void)
|
||||
TRACE(("fin_leaks\n"));
|
||||
if (main_fin) {
|
||||
free_fin_data(main_fin);
|
||||
main_fin = 0;
|
||||
main_fin = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
10
hash.c
10
hash.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: hash.c,v 1.22 2024/08/25 17:46:18 tom Exp $
|
||||
* $MawkId: hash.c,v 1.24 2024/12/14 21:21:20 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_CELL
|
||||
@ -219,8 +219,8 @@ restore_ids(void)
|
||||
const char *
|
||||
reverse_find(int type, PTR ptr)
|
||||
{
|
||||
CELL *cp = 0;
|
||||
ARRAY array = 0;
|
||||
CELL *cp = NULL;
|
||||
ARRAY array = NULL;
|
||||
static char uk[] = "unknown";
|
||||
|
||||
int i;
|
||||
@ -296,7 +296,7 @@ free_hashnode(HASHNODE * p)
|
||||
break;
|
||||
case ST_VAR:
|
||||
cp = p->symtab.stval.cp;
|
||||
if (cp != 0
|
||||
if (cp != NULL
|
||||
&& (cp < bi_vars || cp > bi_vars + NUM_BI_VAR)) {
|
||||
switch (cp->type) {
|
||||
case C_STRING:
|
||||
@ -323,7 +323,7 @@ hash_leaks(void)
|
||||
|
||||
TRACE(("hash_leaks\n"));
|
||||
for (i = 0; i < HASH_PRIME; i++) {
|
||||
while ((p = hash_table[i]) != 0) {
|
||||
while ((p = hash_table[i]) != NULL) {
|
||||
free_hashnode(p);
|
||||
}
|
||||
}
|
||||
|
||||
16
init.c
16
init.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: init.c,v 1.83 2024/11/11 20:58:46 tom Exp $
|
||||
* $MawkId: init.c,v 1.85 2024/12/14 21:21:20 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_ARRAY
|
||||
@ -193,7 +193,7 @@ haveValue(char *value)
|
||||
int result = 0;
|
||||
|
||||
if (*value++ == '=') {
|
||||
if (*value != '\0' && strchr("=,", *value) == 0)
|
||||
if (*value != '\0' && strchr("=,", *value) == NULL)
|
||||
result = 1;
|
||||
}
|
||||
return result;
|
||||
@ -382,7 +382,7 @@ handle_w_opt(W_OPTIONS code, int glue, char *option, char **value)
|
||||
mawk_exit(2);
|
||||
}
|
||||
wantArg = 1;
|
||||
if (optNext != 0) {
|
||||
if (optNext != NULL) {
|
||||
pfile_name = optNext;
|
||||
wantArg = 2;
|
||||
} else {
|
||||
@ -402,7 +402,7 @@ handle_w_opt(W_OPTIONS code, int glue, char *option, char **value)
|
||||
|
||||
case W_RANDOM:
|
||||
wantArg = 1;
|
||||
if (optNext != 0) {
|
||||
if (optNext != NULL) {
|
||||
long x = numeric_option(optNext);
|
||||
CELL c[2];
|
||||
|
||||
@ -423,12 +423,12 @@ handle_w_opt(W_OPTIONS code, int glue, char *option, char **value)
|
||||
|
||||
case W_SPRINTF:
|
||||
wantArg = 1;
|
||||
if (optNext != 0) {
|
||||
if (optNext != NULL) {
|
||||
long x = numeric_option(optNext);
|
||||
|
||||
if (x > (long) sizeof(string_buff)) {
|
||||
if (sprintf_buff != string_buff &&
|
||||
sprintf_buff != 0) {
|
||||
sprintf_buff != NULL) {
|
||||
zfree(sprintf_buff,
|
||||
(size_t) (sprintf_limit - sprintf_buff));
|
||||
}
|
||||
@ -486,7 +486,7 @@ allow_long_options(char *arg, W_OPTIONS seen)
|
||||
char *env = getenv("MAWK_LONG_OPTIONS");
|
||||
int result = 0;
|
||||
|
||||
if (env != 0) {
|
||||
if (env != NULL) {
|
||||
switch (*env) {
|
||||
default:
|
||||
case 'e': /* error */
|
||||
@ -787,7 +787,7 @@ static ALL_ARRAYS *all_arrays;
|
||||
void
|
||||
array_leaks(void)
|
||||
{
|
||||
while (all_arrays != 0) {
|
||||
while (all_arrays != NULL) {
|
||||
ALL_ARRAYS *next = all_arrays->next;
|
||||
array_clear(all_arrays->a);
|
||||
ZFREE(all_arrays->a);
|
||||
|
||||
6
main.c
6
main.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: main.c,v 1.34 2024/09/04 20:28:21 tom Exp $
|
||||
* $MawkId: main.c,v 1.35 2024/12/14 12:53:14 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_CELL
|
||||
@ -52,8 +52,8 @@ main(int argc, char **argv)
|
||||
decimal_dot = '\0'; /* only set to nonzero if not POSIX '.' */
|
||||
setlocale(LC_NUMERIC, "");
|
||||
data = localeconv();
|
||||
if (data != 0
|
||||
&& data->decimal_point != 0
|
||||
if (data != NULL
|
||||
&& data->decimal_point != NULL
|
||||
&& strlen(data->decimal_point) == 1) {
|
||||
decimal_dot = data->decimal_point[0];
|
||||
} else {
|
||||
|
||||
4
mawk.h
4
mawk.h
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: mawk.h,v 1.75 2024/11/17 20:40:48 tom Exp $
|
||||
* $MawkId: mawk.h,v 1.76 2024/12/14 21:21:20 tom Exp $
|
||||
*/
|
||||
|
||||
/* mawk.h */
|
||||
@ -289,7 +289,7 @@ extern void zmalloc_leaks(void);
|
||||
* Optimize-out the assignment to clear the pointer in the array.
|
||||
*/
|
||||
#ifdef NO_LEAKS
|
||||
#define USED_SPLIT_BUFF(n) split_buff[n] = 0
|
||||
#define USED_SPLIT_BUFF(n) split_buff[n] = NULL
|
||||
#else
|
||||
#define USED_SPLIT_BUFF(n) /* nothing */
|
||||
#endif
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
mawk-cur (1.3.4-20241214) unstable; urgency=low
|
||||
|
||||
* maintenance updates
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 14 Dec 2024 12:00:30 -0500
|
||||
|
||||
mawk-cur (1.3.4-20241213) unstable; urgency=low
|
||||
|
||||
* maintenance updates
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# $FreeBSD: head/lang/mawk/Makefile 516890 2019-11-06 14:17:48Z wen $
|
||||
|
||||
PORTNAME= mawk
|
||||
DISTVERSION= 1.3.4.20241213
|
||||
DISTVERSION= 1.3.4.20241214
|
||||
CATEGORIES= lang
|
||||
MASTER_SITES= https://invisible-island.net/archives/${PORTNAME}/ \
|
||||
https://invisible-mirror.net/archives/${PORTNAME}/
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
Summary: mawk - pattern scanning and text processing language
|
||||
%global AppProgram mawk
|
||||
%global AppVersion 1.3.4
|
||||
%global AppPatched 20241213
|
||||
%global AppPatched 20241214
|
||||
%global MySite https://invisible-island.net
|
||||
# $MawkId: mawk.spec,v 1.135 2024/12/14 01:01:15 tom Exp $
|
||||
# $MawkId: mawk.spec,v 1.136 2024/12/14 17:00:30 tom Exp $
|
||||
Name: %{AppProgram}
|
||||
Version: %{AppVersion}
|
||||
Release: %{AppPatched}
|
||||
|
||||
18
parse.y
18
parse.y
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: parse.y,v 1.41 2024/08/26 21:04:00 tom Exp $
|
||||
* $MawkId: parse.y,v 1.42 2024/12/14 12:55:59 tom Exp $
|
||||
*/
|
||||
|
||||
%{
|
||||
@ -1204,11 +1204,11 @@ improve_arglist(const char *name)
|
||||
FCALL_REC *q;
|
||||
|
||||
TRACE(("improve_arglist(%s)\n", name));
|
||||
for (p = active_arglist; p != 0; p = p->link) {
|
||||
for (p = active_arglist; p != NULL; p = p->link) {
|
||||
if (p->type == ST_LOCAL_NONE) {
|
||||
for (q = resolve_list; q != 0; q = q->link) {
|
||||
for (q = resolve_list; q != NULL; q = q->link) {
|
||||
if (!strcmp(q->callee->name, name)) {
|
||||
for (p2 = q->arg_list; p2 != 0; p2 = p2->link) {
|
||||
for (p2 = q->arg_list; p2 != NULL; p2 = p2->link) {
|
||||
if (p2->arg_num == p->arg_num) {
|
||||
switch (p2->type) {
|
||||
case ST_NONE:
|
||||
@ -1249,21 +1249,21 @@ save_arglist(const char *s)
|
||||
SYMTAB *result = save_id(s);
|
||||
CA_REC *saveit = ZMALLOC(CA_REC);
|
||||
|
||||
if (saveit != 0) {
|
||||
if (saveit != NULL) {
|
||||
CA_REC *p, *q;
|
||||
int arg_num = 0;
|
||||
|
||||
for (p = active_arglist, q = 0; p != 0; q = p, p = p->link) {
|
||||
for (p = active_arglist, q = NULL; p != NULL; q = p, p = p->link) {
|
||||
++arg_num;
|
||||
}
|
||||
|
||||
saveit->link = 0;
|
||||
saveit->link = NULL;
|
||||
saveit->type = ST_LOCAL_NONE;
|
||||
saveit->arg_num = (NUM_ARGS) arg_num;
|
||||
saveit->call_lineno = token_lineno;
|
||||
saveit->sym_p = result;
|
||||
|
||||
if (q != 0) {
|
||||
if (q != NULL) {
|
||||
q->link = saveit;
|
||||
} else {
|
||||
active_arglist = saveit;
|
||||
@ -1276,7 +1276,7 @@ save_arglist(const char *s)
|
||||
static void
|
||||
free_arglist(void)
|
||||
{
|
||||
while (active_arglist != 0) {
|
||||
while (active_arglist != NULL) {
|
||||
CA_REC *next = active_arglist->link;
|
||||
ZFREE(active_arglist);
|
||||
active_arglist = next;
|
||||
|
||||
@ -11,9 +11,9 @@ the GNU General Public License, version 2, 1991.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $MawkId: patchlev.h,v 1.162 2024/12/14 01:01:15 tom Exp $
|
||||
* $MawkId: patchlev.h,v 1.163 2024/12/14 17:00:30 tom Exp $
|
||||
*/
|
||||
#define PATCH_BASE 1
|
||||
#define PATCH_LEVEL 3
|
||||
#define PATCH_STRING ".4"
|
||||
#define DATE_STRING "20241213"
|
||||
#define DATE_STRING "20241214"
|
||||
|
||||
20
re_cmpl.c
20
re_cmpl.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: re_cmpl.c,v 1.41 2024/09/05 17:44:48 tom Exp $
|
||||
* $MawkId: re_cmpl.c,v 1.43 2024/12/14 21:21:20 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_CELL
|
||||
@ -119,12 +119,12 @@ re_destroy(PTR m)
|
||||
RE_NODE *q;
|
||||
RE_NODE *r;
|
||||
|
||||
if (p != 0) {
|
||||
for (q = re_list, r = 0; q != 0; r = q, q = q->link) {
|
||||
if (p != NULL) {
|
||||
for (q = re_list, r = NULL; q != NULL; r = q, q = q->link) {
|
||||
if (q == p) {
|
||||
free_STRING(p->sval);
|
||||
REdestroy(p->re.compiled);
|
||||
if (r != 0)
|
||||
if (r != NULL)
|
||||
r->link = q->link;
|
||||
else
|
||||
re_list = q->link;
|
||||
@ -148,9 +148,9 @@ re_destroy(PTR m)
|
||||
* Here are the Posix rules which this code supports:
|
||||
\& --> &
|
||||
\\ --> \
|
||||
\c --> \c
|
||||
& --> matched text
|
||||
|
||||
\c --> \c
|
||||
& --> matched text
|
||||
|
||||
*/
|
||||
|
||||
/* FIXME -- this function doesn't handle embedded nulls
|
||||
@ -279,7 +279,7 @@ repl_destroy(CELL *cp)
|
||||
|
||||
if (cp->type == C_REPL) {
|
||||
free_STRING(string(cp));
|
||||
} else if (cp->ptr != 0) { /* an C_REPLV */
|
||||
} else if (cp->ptr != NULL) { /* an C_REPLV */
|
||||
p = (STRING **) cp->ptr;
|
||||
for (cnt = cp->vcnt; cnt; cnt--) {
|
||||
if (*p) {
|
||||
@ -475,14 +475,14 @@ no_leaks_re_ptr(PTR m)
|
||||
void
|
||||
re_leaks(void)
|
||||
{
|
||||
while (all_ptrs != 0) {
|
||||
while (all_ptrs != NULL) {
|
||||
ALL_PTRS *next = all_ptrs->next;
|
||||
re_destroy(all_ptrs->m);
|
||||
free(all_ptrs);
|
||||
all_ptrs = next;
|
||||
}
|
||||
|
||||
while (repl_list != 0) {
|
||||
while (repl_list != NULL) {
|
||||
REPL_NODE *p = repl_list->link;
|
||||
free_STRING(repl_list->sval);
|
||||
free_cell_data(repl_list->cp);
|
||||
|
||||
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $MawkId: regexp_system.c,v 1.41 2024/08/25 17:15:43 tom Exp $
|
||||
* $MawkId: regexp_system.c,v 1.42 2024/12/14 17:39:48 tom Exp $
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
@ -51,7 +51,7 @@ static char *
|
||||
prepare_regexp(char *regexp, const char *source, size_t limit)
|
||||
{
|
||||
const char *base = source;
|
||||
const char *range = 0;
|
||||
const char *range = NULL;
|
||||
int escape = 0;
|
||||
int cclass = 0;
|
||||
int radix = 0;
|
||||
@ -238,7 +238,7 @@ prepare_regexp(char *regexp, const char *source, size_t limit)
|
||||
}
|
||||
break;
|
||||
case '[':
|
||||
if (range == 0) {
|
||||
if (range == NULL) {
|
||||
range = tail;
|
||||
} else {
|
||||
if (NEXT_CH() == ':') {
|
||||
@ -248,7 +248,7 @@ prepare_regexp(char *regexp, const char *source, size_t limit)
|
||||
*tail++ = ch;
|
||||
break;
|
||||
case ']':
|
||||
if (range != 0) {
|
||||
if (range != NULL) {
|
||||
if (cclass != 0) {
|
||||
if (source[-2] == cclass) {
|
||||
cclass = 0;
|
||||
@ -256,7 +256,7 @@ prepare_regexp(char *regexp, const char *source, size_t limit)
|
||||
} else if (tail == range + 1
|
||||
|| (tail == range + 2 && range[1] == '^')
|
||||
|| (tail > range + 2)) {
|
||||
range = 0;
|
||||
range = NULL;
|
||||
}
|
||||
}
|
||||
*tail++ = ch;
|
||||
@ -268,7 +268,7 @@ prepare_regexp(char *regexp, const char *source, size_t limit)
|
||||
break;
|
||||
} else
|
||||
#endif
|
||||
if (range == 0 &&
|
||||
if (range == NULL &&
|
||||
((tail == regexp) ||
|
||||
(tail[-1] == '*') ||
|
||||
(tail[-1] == '?'))) {
|
||||
@ -284,7 +284,7 @@ prepare_regexp(char *regexp, const char *source, size_t limit)
|
||||
break;
|
||||
} else
|
||||
#endif
|
||||
if (range == 0)
|
||||
if (range == NULL)
|
||||
*tail++ = '\\';
|
||||
*tail++ = ch;
|
||||
break;
|
||||
@ -306,7 +306,7 @@ REcompile(char *regexp, size_t len)
|
||||
{
|
||||
mawk_re_t *re = (mawk_re_t *) malloc(sizeof(mawk_re_t));
|
||||
|
||||
if (re != 0) {
|
||||
if (re != NULL) {
|
||||
size_t need = (len * 2) + 8; /* might double, with escaping */
|
||||
char *new_regexp = (char *) malloc(need);
|
||||
|
||||
|
||||
8
rexp.c
8
rexp.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: rexp.c,v 1.52 2024/11/17 23:31:54 tom Exp $
|
||||
* $MawkId: rexp.c,v 1.53 2024/12/14 12:55:59 tom Exp $
|
||||
*/
|
||||
|
||||
/* op precedence parser for regular expressions */
|
||||
@ -174,7 +174,7 @@ REcompile(char *re, size_t len)
|
||||
goto default_case;
|
||||
}
|
||||
/* interval expression {n,m}
|
||||
* eg,
|
||||
* eg,
|
||||
* convert m{3} to mmm
|
||||
* convert m{3,} to mmm* (with a limit of MAX_INT)
|
||||
* convert m{3,10} to mmm* with a limit of 10
|
||||
@ -185,7 +185,7 @@ REcompile(char *re, size_t len)
|
||||
if (intrvalmin == 0) { /* zero or more */
|
||||
switch (intrvalmax) {
|
||||
case 0:
|
||||
/* user stupidity: m{0} or m{0,0}
|
||||
/* user stupidity: m{0} or m{0,0}
|
||||
* don't add this re token
|
||||
*/
|
||||
if (m_ptr == m_array) {
|
||||
@ -249,7 +249,7 @@ REcompile(char *re, size_t len)
|
||||
RE_poscl_limit(m_ptr, intrvalmin, intrvalmax);
|
||||
TRACE(("RE_lex token %s\n", token_name(T_PLUS)));
|
||||
#endif
|
||||
} else if (m_ptr->start != 0) { /* n or more */
|
||||
} else if (m_ptr->start != NULL) { /* n or more */
|
||||
register Int i;
|
||||
/* copy 2 copies of m_ptr, use 2nd copy to replace
|
||||
the first copy that gets swallowed by concat */
|
||||
|
||||
28
rexp0.c
28
rexp0.c
@ -12,7 +12,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: rexp0.c,v 1.48 2024/08/25 17:16:24 tom Exp $
|
||||
* $MawkId: rexp0.c,v 1.50 2024/12/14 21:21:20 tom Exp $
|
||||
*/
|
||||
|
||||
/* lexical scanner */
|
||||
@ -114,14 +114,14 @@ ok_intervals(const char *p)
|
||||
/*
|
||||
Collect two numbers between T_LB and T_RB, saving
|
||||
the values in intrvalmin and intrvalmax.
|
||||
|
||||
|
||||
There are three ways the interval expressions are formed:
|
||||
{n} => previous regexp is repeated n times
|
||||
{n,m} => previous regexp is repeated n to m times
|
||||
{n,} => previous regexp is repeated n or more times
|
||||
{,m} => {0,m}
|
||||
Note: awk doesn't define {,m}
|
||||
|
||||
|
||||
returns: T_RB, or on error T_CHAR
|
||||
*/
|
||||
|
||||
@ -410,7 +410,7 @@ do_str(
|
||||
MACHINE * mp) /* where to put the string machine */
|
||||
{
|
||||
register char *p; /* runs thru the input */
|
||||
char *pt = 0; /* trails p by one */
|
||||
char *pt = NULL; /* trails p by one */
|
||||
char *str; /* collect it here */
|
||||
register char *s; /* runs thru the output */
|
||||
size_t len; /* length collected */
|
||||
@ -537,7 +537,7 @@ lookup_cclass(char **start)
|
||||
CCLASS_DATA(upper),
|
||||
CCLASS_DATA(xdigit),
|
||||
};
|
||||
CCLASS *result = 0;
|
||||
CCLASS *result = NULL;
|
||||
CCLASS_ENUM code = CCLASS_NONE;
|
||||
const char *name;
|
||||
char *colon;
|
||||
@ -545,20 +545,20 @@ lookup_cclass(char **start)
|
||||
size_t item;
|
||||
|
||||
#ifdef NO_LEAKS
|
||||
if (start == 0) {
|
||||
if (start == NULL) {
|
||||
for (item = 0; item < (sizeof(cclass_data) /
|
||||
sizeof(cclass_data[0])); ++item) {
|
||||
if (cclass_data[item]) {
|
||||
free(cclass_data[item]);
|
||||
cclass_data[item] = 0;
|
||||
cclass_data[item] = NULL;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
name = (*start += 2); /* point past "[:" */
|
||||
colon = strchr(name, ':');
|
||||
if (colon == 0 || colon[1] != ']') {
|
||||
if (colon == NULL || colon[1] != ']') {
|
||||
RE_error_trap(-ERR_3);
|
||||
}
|
||||
|
||||
@ -617,7 +617,7 @@ lookup_cclass(char **start)
|
||||
RE_error_trap(-ERR_3);
|
||||
}
|
||||
|
||||
if ((result = cclass_data[item]) == 0) {
|
||||
if ((result = cclass_data[item]) == NULL) {
|
||||
int ch = 0;
|
||||
size_t have = 4;
|
||||
size_t used = 0;
|
||||
@ -704,12 +704,12 @@ lookup_cclass(char **start)
|
||||
static CCLASS *
|
||||
get_cclass(char *start, char **next)
|
||||
{
|
||||
CCLASS *result = 0;
|
||||
CCLASS *result = NULL;
|
||||
|
||||
if (start[0] == '['
|
||||
&& start[1] == ':') {
|
||||
result = lookup_cclass(&start);
|
||||
if (next != 0) {
|
||||
if (next != NULL) {
|
||||
*next = start;
|
||||
}
|
||||
}
|
||||
@ -727,7 +727,7 @@ literal_leftsq(char *start)
|
||||
{
|
||||
int result = 0;
|
||||
if (start[0] == '[') {
|
||||
if (get_cclass(start, 0) == 0)
|
||||
if (get_cclass(start, NULL) == NULL)
|
||||
result = 1;
|
||||
}
|
||||
return result;
|
||||
@ -805,7 +805,7 @@ do_class(char **start, MACHINE * mp)
|
||||
break;
|
||||
|
||||
case '[':
|
||||
if ((cclass = get_cclass(p, &p)) != 0) {
|
||||
if ((cclass = get_cclass(p, &p)) != NULL) {
|
||||
while (cclass->first >= 0) {
|
||||
block_on(*bvp, cclass->first, cclass->last);
|
||||
++cclass;
|
||||
|
||||
6
rexp1.c
6
rexp1.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: rexp1.c,v 1.27 2024/08/25 17:16:24 tom Exp $
|
||||
* $MawkId: rexp1.c,v 1.28 2024/12/14 12:57:40 tom Exp $
|
||||
*/
|
||||
|
||||
/* re machine operations */
|
||||
@ -327,7 +327,7 @@ RE_malloc(size_t sz)
|
||||
|
||||
p = malloc(sz);
|
||||
TRACE(("RE_malloc(%lu) ->%p\n", (unsigned long) sz, p));
|
||||
if (p == 0)
|
||||
if (p == NULL)
|
||||
RE_error_trap(MEMORY_FAILURE);
|
||||
return p;
|
||||
}
|
||||
@ -340,7 +340,7 @@ RE_realloc(PTR p, size_t sz)
|
||||
TRACE(("RE_realloc(%p, %lu) ", p, (unsigned long) sz));
|
||||
q = realloc(p, sz);
|
||||
TRACE(("->%p\n", q));
|
||||
if (q == 0)
|
||||
if (q == NULL)
|
||||
RE_error_trap(MEMORY_FAILURE);
|
||||
return q;
|
||||
}
|
||||
|
||||
4
rexp2.c
4
rexp2.c
@ -12,7 +12,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: rexp2.c,v 1.48 2024/12/10 21:34:14 tom Exp $
|
||||
* $MawkId: rexp2.c,v 1.49 2024/12/14 12:57:40 tom Exp $
|
||||
*/
|
||||
|
||||
/* test a string against a machine */
|
||||
@ -452,7 +452,7 @@ is_string_split(PTR q, size_t * lenp)
|
||||
{
|
||||
STATE *p = cast_to_re(q);
|
||||
|
||||
if (p != 0 && (p[0].s_type == M_STR && p[1].s_type == M_ACCEPT)) {
|
||||
if (p != NULL && (p[0].s_type == M_STR && p[1].s_type == M_ACCEPT)) {
|
||||
*lenp = p->s_len;
|
||||
return p->s_data.str;
|
||||
} else
|
||||
|
||||
10
scan.c
10
scan.c
@ -12,7 +12,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: scan.c,v 1.67 2024/11/11 20:58:37 tom Exp $
|
||||
* $MawkId: scan.c,v 1.69 2024/12/14 21:21:20 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_ARRAY
|
||||
@ -843,7 +843,7 @@ collect_decimal(int c, int *flag)
|
||||
register char *p = string_buff + 1;
|
||||
char *endp;
|
||||
char *temp;
|
||||
char *last_decimal = 0;
|
||||
char *last_decimal = NULL;
|
||||
double d;
|
||||
|
||||
*flag = 0;
|
||||
@ -1089,7 +1089,7 @@ rm_escape(char *s, size_t *lenp)
|
||||
}
|
||||
|
||||
*q = 0;
|
||||
if (lenp != 0)
|
||||
if (lenp != NULL)
|
||||
*lenp = (unsigned) (q - s);
|
||||
return s;
|
||||
}
|
||||
@ -1186,7 +1186,7 @@ collect_RE(void)
|
||||
switch (scan_code[NextChar(c = *p++)]) {
|
||||
case SC_POW:
|
||||
/* Handle [^]] and [^^] correctly. */
|
||||
if ((p - 1) == first && first != 0 && first[-1] == '[') {
|
||||
if ((p - 1) == first && first != NULL && first[-1] == '[') {
|
||||
first = p;
|
||||
}
|
||||
break;
|
||||
@ -1280,7 +1280,7 @@ scan_leaks(void)
|
||||
TRACE(("scan_leaks\n"));
|
||||
if (yylval.ptr) {
|
||||
free(yylval.ptr);
|
||||
yylval.ptr = 0;
|
||||
yylval.ptr = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
12
split.c
12
split.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: split.c,v 1.36 2024/09/05 17:44:48 tom Exp $
|
||||
* $MawkId: split.c,v 1.37 2024/12/14 12:53:38 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_BI_REC
|
||||
@ -54,7 +54,7 @@ static void
|
||||
spb_list_shrink(void)
|
||||
{
|
||||
Split_Block_Node *p = split_block_list->link;
|
||||
split_block_list->link = 0;
|
||||
split_block_list->link = NULL;
|
||||
while (p) {
|
||||
Split_Block_Node *hold = p;
|
||||
p = p->link;
|
||||
@ -72,13 +72,13 @@ grow_sp_list(Split_Block_Node * tail)
|
||||
{
|
||||
tail->link = (Split_Block_Node *) zmalloc(sizeof(Split_Block_Node));
|
||||
tail = tail->link;
|
||||
tail->link = 0;
|
||||
tail->link = NULL;
|
||||
return tail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Split string s of length slen on SPACE without changing s.
|
||||
* Load the pieces into STRINGS
|
||||
* Load the pieces into STRINGS
|
||||
* return the number of pieces
|
||||
*/
|
||||
size_t
|
||||
@ -180,11 +180,11 @@ re_pos_match(char *str, size_t str_len, RE_NODE * re, size_t *lenp, int no_bol)
|
||||
} else {
|
||||
/* no match */
|
||||
*lenp = 0;
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
*lenp = 0;
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
12
trace.c
12
trace.c
@ -10,7 +10,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: trace.c,v 1.24 2024/09/05 17:44:48 tom Exp $
|
||||
* $MawkId: trace.c,v 1.26 2024/12/14 21:21:34 tom Exp $
|
||||
*/
|
||||
|
||||
#define Visible_CELL
|
||||
@ -26,10 +26,10 @@ Trace(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
if (trace_fp == 0)
|
||||
if (trace_fp == NULL)
|
||||
trace_fp = fopen("Trace.out", "w");
|
||||
|
||||
if (trace_fp == 0)
|
||||
if (trace_fp == NULL)
|
||||
rt_error("cannot open Trace.out");
|
||||
|
||||
va_start(args, format);
|
||||
@ -49,7 +49,7 @@ void
|
||||
TraceCell(CELL *cp)
|
||||
{
|
||||
TRACE(("cell %p ", (void *) cp));
|
||||
if (cp != 0) {
|
||||
if (cp != NULL) {
|
||||
switch ((MAWK_CELL_TYPES) cp->type) {
|
||||
case C_NOINIT:
|
||||
TRACE(("is empty\n"));
|
||||
@ -284,9 +284,9 @@ TraceString(STRING * sp)
|
||||
void
|
||||
trace_leaks(void)
|
||||
{
|
||||
if (trace_fp != 0) {
|
||||
if (trace_fp != NULL) {
|
||||
fclose(trace_fp);
|
||||
trace_fp = 0;
|
||||
trace_fp = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
14
zmalloc.c
14
zmalloc.c
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
|
||||
********************************************/
|
||||
|
||||
/*
|
||||
* $MawkId: zmalloc.c,v 1.36 2024/11/11 20:56:32 tom Exp $
|
||||
* $MawkId: zmalloc.c,v 1.38 2024/12/14 21:21:20 tom Exp $
|
||||
*/
|
||||
|
||||
/* zmalloc.c */
|
||||
@ -139,8 +139,8 @@ record_ptr(PTR ptr, size_t size)
|
||||
|
||||
TRACE(("record_ptr %p -> %p %lu\n", (void *) item, ptr, (unsigned long) size));
|
||||
result = tsearch(item, &ptr_data, compare_ptr_data);
|
||||
assert(result != 0);
|
||||
assert(*result != 0);
|
||||
assert(result != NULL);
|
||||
assert(*result != NULL);
|
||||
|
||||
TRACE2(("->%p (%p %lu)\n",
|
||||
(*result), (*result)->ptr,
|
||||
@ -162,8 +162,8 @@ finish_ptr(PTR ptr, size_t size)
|
||||
TRACE2(("finish_ptr (%p) -> %p %lu\n", &dummy, ptr, (unsigned long) size));
|
||||
item = tfind(&dummy, &ptr_data, compare_ptr_data);
|
||||
|
||||
assert(item != 0);
|
||||
assert(*item != 0);
|
||||
assert(item != NULL);
|
||||
assert(*item != NULL);
|
||||
|
||||
TRACE(("finish_ptr %p -> %p %lu\n",
|
||||
(void *) (*item),
|
||||
@ -231,7 +231,7 @@ zmalloc(size_t size)
|
||||
RecordPtr(p, size);
|
||||
} else {
|
||||
|
||||
if ((p = pool[blocks - 1]) != 0) {
|
||||
if ((p = pool[blocks - 1]) != NULL) {
|
||||
pool[blocks - 1] = p->link;
|
||||
} else {
|
||||
|
||||
@ -315,7 +315,7 @@ zmalloc_leaks(void)
|
||||
{
|
||||
#ifdef USE_TSEARCH
|
||||
TRACE(("zmalloc_leaks\n"));
|
||||
while (ptr_data != 0) {
|
||||
while (ptr_data != NULL) {
|
||||
PTR_DATA *data = *(PTR_DATA **) ptr_data;
|
||||
tdelete(data, &ptr_data, compare_ptr_data);
|
||||
free_ptr_data(data);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user