aboutsummaryrefslogtreecommitdiff
path: root/ncurses/trace
diff options
context:
space:
mode:
Diffstat (limited to 'ncurses/trace')
-rw-r--r--ncurses/trace/lib_trace.c22
-rw-r--r--ncurses/trace/lib_traceatr.c35
-rw-r--r--ncurses/trace/lib_tracebits.c22
-rw-r--r--ncurses/trace/lib_tracechr.c10
-rw-r--r--ncurses/trace/lib_tracedmp.c8
-rw-r--r--ncurses/trace/lib_tracemse.c10
-rw-r--r--ncurses/trace/trace_buf.c26
-rw-r--r--ncurses/trace/trace_tries.c10
-rw-r--r--ncurses/trace/varargs.c38
-rw-r--r--ncurses/trace/visbuf.c24
10 files changed, 103 insertions, 102 deletions
diff --git a/ncurses/trace/lib_trace.c b/ncurses/trace/lib_trace.c
index 0904c132fee1..a7197b0d371a 100644
--- a/ncurses/trace/lib_trace.c
+++ b/ncurses/trace/lib_trace.c
@@ -48,7 +48,7 @@
#include <ctype.h>
-MODULE_ID("$Id: lib_trace.c,v 1.106 2024/02/24 18:28:19 tom Exp $")
+MODULE_ID("$Id: lib_trace.c,v 1.109 2024/12/07 21:02:00 tom Exp $")
NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
@@ -135,7 +135,7 @@ curses_trace(unsigned tracelevel)
Locked(result = _nc_tracing);
- if ((MyFP == 0) && tracelevel) {
+ if ((MyFP == NULL) && tracelevel) {
MyInit = TRUE;
if (MyFD >= 0) {
MyFP = fdopen(MyFD, BIN_W);
@@ -149,7 +149,7 @@ curses_trace(unsigned tracelevel)
#define SAFE_MODE (O_CREAT | O_EXCL | O_RDWR)
if (_nc_access(myFile, W_OK) < 0
|| (MyFD = safe_open3(myFile, SAFE_MODE, 0600)) < 0
- || (MyFP = fdopen(MyFD, BIN_W)) == 0) {
+ || (MyFP = fdopen(MyFD, BIN_W)) == NULL) {
; /* EMPTY */
}
}
@@ -158,7 +158,7 @@ curses_trace(unsigned tracelevel)
* so that the trace-output gets flushed automatically at the
* end of each line. This is useful in case the program dies.
*/
- if (MyFP != 0) {
+ if (MyFP != NULL) {
#if HAVE_SETVBUF /* ANSI */
(void) setvbuf(MyFP, (char *) 0, _IOLBF, (size_t) 0);
#elif HAVE_SETBUF /* POSIX */
@@ -188,10 +188,10 @@ curses_trace(unsigned tracelevel)
_tracef("- DEBUG_LEVEL(%u)", tracelevel >> TRACE_SHIFT);
}
} else if (tracelevel == 0) {
- if (MyFP != 0) {
+ if (MyFP != NULL) {
MyFD = dup(MyFD); /* allow reopen of same file */
fclose(MyFP);
- MyFP = 0;
+ MyFP = NULL;
}
Locked(_nc_tracing = tracelevel);
} else if (_nc_tracing != tracelevel) {
@@ -226,7 +226,7 @@ _nc_va_tracef(const char *fmt, va_list ap)
#ifdef TRACE
/* verbose-trace in the command-line utilities relies on this */
- if (fp == 0 && !MyInit && _nc_tracing >= DEBUG_LEVEL(1))
+ if (fp == NULL && !MyInit && _nc_tracing >= DEBUG_LEVEL(1))
fp = stderr;
#endif
@@ -246,7 +246,7 @@ _nc_va_tracef(const char *fmt, va_list ap)
}
}
- if (doit != 0 && fp != 0) {
+ if (doit != 0 && fp != NULL) {
#ifdef USE_PTHREADS
/*
* TRACE_ICALLS is "really" needed to show normal use with threaded
@@ -261,7 +261,7 @@ _nc_va_tracef(const char *fmt, va_list ap)
if ((pthread_self))
# endif
fprintf(fp, "%#" PRIxPTR ":",
-#ifdef _NC_WINDOWS
+#ifdef _NC_WINDOWS_NATIVE
CASTxPTR(pthread_self().p)
#else
CASTxPTR(pthread_self())
@@ -295,8 +295,8 @@ _tracef(const char *fmt, ...)
}
/* Trace 'bool' return-values */
-NCURSES_EXPORT(NCURSES_BOOL)
-_nc_retrace_bool(int code)
+NCURSES_EXPORT(bool)
+_nc_retrace_bool(bool code)
{
T((T_RETURN("%s"), code ? "TRUE" : "FALSE"));
return code;
diff --git a/ncurses/trace/lib_traceatr.c b/ncurses/trace/lib_traceatr.c
index b36286253d6d..63dc9f22dfe5 100644
--- a/ncurses/trace/lib_traceatr.c
+++ b/ncurses/trace/lib_traceatr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2018-2022,2024 Thomas E. Dickey *
+ * Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 1998-2017,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -44,7 +44,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_traceatr.c,v 1.96 2024/02/04 00:11:35 tom Exp $")
+MODULE_ID("$Id: lib_traceatr.c,v 1.101 2025/11/16 16:08:54 tom Exp $")
#define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name))
@@ -126,7 +126,7 @@ _traceattr2(int bufnum, chtype newmode)
#undef DATA
char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
- if (result != 0) {
+ if (result != NULL) {
size_t n;
unsigned save_nc_tracing = _nc_tracing;
@@ -167,7 +167,7 @@ _traceattr2(int bufnum, chtype newmode)
}
}
if (ChAttrOf(newmode) == A_NORMAL) {
- if (result != 0 && result[1] != '\0')
+ if (result != NULL && result[1] != '\0')
(void) _nc_trace_bufcat(bufnum, "|");
(void) _nc_trace_bufcat(bufnum, "A_NORMAL");
}
@@ -248,14 +248,14 @@ _nc_altcharset_name(attr_t attr, chtype ch)
};
#undef DATA
- const char *result = 0;
+ const char *result = NULL;
#if NCURSES_SP_FUNCS
(void) sp;
#endif
- if (SP_PARM != 0 && (attr & A_ALTCHARSET) && (acs_chars != 0)) {
+ if (SP_PARM != NULL && (attr & A_ALTCHARSET) && (acs_chars != NULL)) {
char *cp;
- char *found = 0;
+ const char *found = NULL;
for (cp = acs_chars; cp[0] && cp[1]; cp += 2) {
if (ChCharOf(UChar(cp[1])) == ChCharOf(ch)) {
@@ -264,7 +264,7 @@ _nc_altcharset_name(attr_t attr, chtype ch)
}
}
- if (found != 0) {
+ if (found != NULL) {
size_t n;
ch = ChCharOf(UChar(*found));
@@ -284,12 +284,12 @@ _tracechtype2(int bufnum, chtype ch)
{
char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
- if (result != 0) {
+ if (result != NULL) {
const char *found;
attr_t attr = ChAttrOf(ch);
_nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum));
- if ((found = _nc_altcharset_name(attr, ch)) != 0) {
+ if ((found = _nc_altcharset_name(attr, ch)) != NULL) {
(void) _nc_trace_bufcat(bufnum, found);
attr &= ~A_ALTCHARSET;
} else
@@ -328,13 +328,13 @@ _tracecchar_t2(int bufnum, const cchar_t *ch)
{
char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
- if (result != 0) {
+ if (result != NULL) {
_nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum));
- if (ch != 0) {
+ if (ch != NULL) {
const char *found;
attr_t attr = AttrOfD(ch);
- if ((found = _nc_altcharset_name(attr, (chtype) CharOfD(ch))) != 0) {
+ if ((found = _nc_altcharset_name(attr, (chtype) CharOfD(ch))) != NULL) {
(void) _nc_trace_bufcat(bufnum, found);
attr &= ~A_ALTCHARSET;
} else if (isWidecExt(CHDEREF(ch))) {
@@ -363,7 +363,7 @@ _tracecchar_t2(int bufnum, const cchar_t *ch)
UChar(ch->chars[PUTC_i])));
}
break;
- } else if (ch->chars[PUTC_i] > assume_unicode) {
+ } else if ((int) ch->chars[PUTC_i] > assume_unicode) {
char temp[80];
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
"{%d:\\u%04lx}",
@@ -371,7 +371,7 @@ _tracecchar_t2(int bufnum, const cchar_t *ch)
(unsigned long) ch->chars[PUTC_i]);
(void) _nc_trace_bufcat(bufnum, temp);
attr &= ~A_CHARTEXT; /* ignore WidecExt(ch) */
- } else {
+ } else if (PUTC_n > 1 || !is8bits(ch->chars[PUTC_i])) {
for (n = 0; n < PUTC_n; n++) {
if (n)
(void) _nc_trace_bufcat(bufnum, ", ");
@@ -379,6 +379,11 @@ _tracecchar_t2(int bufnum, const cchar_t *ch)
_nc_tracechar(CURRENT_SCREEN,
UChar(PUTC_buf[n])));
}
+ } else {
+ char temp[2];
+ temp[0] = (char) ch->chars[PUTC_i];
+ temp[1] = 0;
+ (void) _nc_trace_bufcat(bufnum, temp);
}
}
(void) _nc_trace_bufcat(bufnum, " }");
diff --git a/ncurses/trace/lib_tracebits.c b/ncurses/trace/lib_tracebits.c
index 4bc50f3b0857..b9f44888896e 100644
--- a/ncurses/trace/lib_tracebits.c
+++ b/ncurses/trace/lib_tracebits.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2024,2025 Thomas E. Dickey *
* Copyright 1998-2012,2015 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -35,16 +35,12 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_tracebits.c,v 1.31 2020/11/14 23:38:11 tom Exp $")
+MODULE_ID("$Id: lib_tracebits.c,v 1.37 2025/12/23 09:23:38 tom Exp $")
#if HAVE_SYS_TERMIO_H
#include <sys/termio.h> /* needed for ISC */
#endif
-#ifdef __EMX__
-#include <io.h>
-#endif
-
/* may be undefined if we're using termio.h */
#ifndef TOSTOP
#define TOSTOP 0
@@ -72,21 +68,21 @@ MODULE_ID("$Id: lib_tracebits.c,v 1.31 2020/11/14 23:38:11 tom Exp $")
#ifdef TRACE
-#if defined(EXP_WIN32_DRIVER)
+#if defined(USE_WIN32CON_DRIVER)
#define BITNAMELEN 36
#else
#define BITNAMELEN 8
#endif
typedef struct {
- unsigned int val;
+ unsigned long val;
const char name[BITNAMELEN];
} BITNAMES;
#define TRACE_BUF_SIZE(num) (_nc_globals.tracebuf_ptr[num].size)
static void
-lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned int val)
+lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned long val)
{
const BITNAMES *sp;
@@ -172,7 +168,7 @@ _nc_trace_ttymode(const TTY * tty)
8 + sizeof(cflags) +
8 + sizeof(lflags) +
8);
- if (buf != 0) {
+ if (buf != NULL) {
if (tty->c_iflag & ALLIN)
lookup_bits(buf, iflags, "iflags", tty->c_iflag);
@@ -218,7 +214,7 @@ _nc_trace_ttymode(const TTY * tty)
if (tty->c_lflag & ALLLOCAL)
lookup_bits(buf, lflags, "lflags", tty->c_lflag);
}
-#elif defined(EXP_WIN32_DRIVER)
+#elif defined(USE_WIN32CON_DRIVER)
#define DATA(name) { name, { #name } }
static const BITNAMES dwFlagsOut[] =
{
@@ -244,7 +240,7 @@ _nc_trace_ttymode(const TTY * tty)
buf = _nc_trace_buf(0,
8 + sizeof(dwFlagsOut) +
8 + sizeof(dwFlagsIn));
- if (buf != 0) {
+ if (buf != NULL) {
lookup_bits(buf, dwFlagsIn, "dwIn", tty->dwFlagIn);
lookup_bits(buf, dwFlagsOut, "dwOut", tty->dwFlagOut);
}
@@ -284,7 +280,7 @@ _nc_trace_ttymode(const TTY * tty)
buf = _nc_trace_buf(0,
8 + sizeof(cflags));
- if (buf != 0) {
+ if (buf != NULL) {
if (tty->sg_flags & ALLCTRL) {
lookup_bits(buf, cflags, "cflags", tty->sg_flags);
}
diff --git a/ncurses/trace/lib_tracechr.c b/ncurses/trace/lib_tracechr.c
index 9c879dc67397..db3cb530908a 100644
--- a/ncurses/trace/lib_tracechr.c
+++ b/ncurses/trace/lib_tracechr.c
@@ -40,7 +40,7 @@
#include <ctype.h>
-MODULE_ID("$Id: lib_tracechr.c,v 1.24 2024/02/04 00:11:35 tom Exp $")
+MODULE_ID("$Id: lib_tracechr.c,v 1.26 2024/12/07 21:02:00 tom Exp $")
#ifdef TRACE
@@ -50,16 +50,16 @@ NCURSES_EXPORT(char *)
_nc_tracechar(SCREEN *sp, int ch)
{
NCURSES_CONST char *name;
- char *MyBuffer = ((sp != 0)
+ char *MyBuffer = ((sp != NULL)
? sp->tracechr_buf
: _nc_globals.tracechr_buf);
if ((ch > KEY_MIN && !_nc_unicode_locale()) || ch < 0) {
name = safe_keyname(SP_PARM, ch);
- if (name == 0 || *name == '\0')
+ if (name == NULL || *name == '\0')
name = "NULL";
_nc_SPRINTF(MyBuffer, _nc_SLIMIT(MyBufSize)
- "'%.30s' = \\x%02x", name, ch);
+ "'%.30s' = \\x%02x", name, UChar(ch));
} else if (!is8bits(ch)
|| (_nc_unicode_locale() && !is7bits(ch))
|| !isprint(UChar(ch))) {
@@ -72,7 +72,7 @@ _nc_tracechar(SCREEN *sp, int ch)
"\\x%02x", ch);
} else {
name = safe_unctrl(SP_PARM, (chtype) ch);
- if (name == 0 || *name == 0)
+ if (name == NULL || *name == 0)
name = "null"; /* shouldn't happen */
_nc_SPRINTF(MyBuffer, _nc_SLIMIT(MyBufSize)
"'%.30s' = \\x%02x", name, ch);
diff --git a/ncurses/trace/lib_tracedmp.c b/ncurses/trace/lib_tracedmp.c
index 529148bb785a..218a15e0f62e 100644
--- a/ncurses/trace/lib_tracedmp.c
+++ b/ncurses/trace/lib_tracedmp.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2020,2023 Thomas E. Dickey *
+ * Copyright 2020-2023,2024 Thomas E. Dickey *
* Copyright 1998-2012,2016 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -40,7 +40,7 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_tracedmp.c,v 1.37 2023/06/24 15:49:45 tom Exp $")
+MODULE_ID("$Id: lib_tracedmp.c,v 1.38 2024/12/07 20:06:49 tom Exp $")
#ifdef TRACE
@@ -72,7 +72,7 @@ _tracedump(const char *name, WINDOW *win)
my_length = (unsigned) (2 * (width + 1));
my_buffer = typeRealloc(char, my_length, my_buffer);
}
- if (my_buffer == 0)
+ if (my_buffer == NULL)
return;
for (n = 0; n <= win->_maxy; ++n) {
@@ -177,7 +177,7 @@ _tracedump(const char *name, WINDOW *win)
}
#if NO_LEAKS
free(my_buffer);
- my_buffer = 0;
+ my_buffer = NULL;
my_length = 0;
#endif
}
diff --git a/ncurses/trace/lib_tracemse.c b/ncurses/trace/lib_tracemse.c
index 33d4d3d300d3..bbca18b009dc 100644
--- a/ncurses/trace/lib_tracemse.c
+++ b/ncurses/trace/lib_tracemse.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2020 Thomas E. Dickey *
+ * Copyright 2020,2024 Thomas E. Dickey *
* Copyright 1998-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -39,7 +39,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_tracemse.c,v 1.23 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_tracemse.c,v 1.24 2024/12/07 20:06:49 tom Exp $")
#ifdef TRACE
@@ -117,9 +117,9 @@ _nc_trace_mmask_t(SCREEN *sp, mmask_t code)
NCURSES_EXPORT(char *)
_nc_tracemouse(SCREEN *sp, MEVENT const *ep)
{
- char *result = 0;
+ char *result = NULL;
- if (sp != 0) {
+ if (sp != NULL) {
_nc_SPRINTF(my_buffer, _nc_SLIMIT(sizeof(my_buffer))
TRACEMSE_FMT,
ep->id,
@@ -138,7 +138,7 @@ _nc_tracemouse(SCREEN *sp, MEVENT const *ep)
NCURSES_EXPORT(mmask_t)
_nc_retrace_mmask_t(SCREEN *sp, mmask_t code)
{
- if (sp != 0) {
+ if (sp != NULL) {
*my_buffer = '\0';
T((T_RETURN("{%s}"), _nc_trace_mmask_t(sp, code)));
} else {
diff --git a/ncurses/trace/trace_buf.c b/ncurses/trace/trace_buf.c
index 91b12e45c248..0ab258d43d9d 100644
--- a/ncurses/trace/trace_buf.c
+++ b/ncurses/trace/trace_buf.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2020,2023 Thomas E. Dickey *
+ * Copyright 2020-2023,2024 Thomas E. Dickey *
* Copyright 1998-2011,2012 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -36,7 +36,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: trace_buf.c,v 1.22 2023/06/24 13:37:25 tom Exp $")
+MODULE_ID("$Id: trace_buf.c,v 1.23 2024/12/07 21:24:18 tom Exp $")
#ifdef TRACE
@@ -46,22 +46,22 @@ MODULE_ID("$Id: trace_buf.c,v 1.22 2023/06/24 13:37:25 tom Exp $")
static char *
_nc_trace_alloc(int bufnum, size_t want)
{
- char *result = 0;
+ char *result = NULL;
if (bufnum >= 0) {
if ((size_t) (bufnum + 1) > MySize) {
size_t need = (size_t) (bufnum + 1) * 2;
- if ((MyList = typeRealloc(TRACEBUF, need, MyList)) != 0) {
+ if ((MyList = typeRealloc(TRACEBUF, need, MyList)) != NULL) {
while (need > MySize)
- MyList[MySize++].text = 0;
+ MyList[MySize++].text = NULL;
}
}
- if (MyList != 0) {
- if (MyList[bufnum].text == 0
+ if (MyList != NULL) {
+ if (MyList[bufnum].text == NULL
|| want > MyList[bufnum].size) {
MyList[bufnum].text = typeRealloc(char, want, MyList[bufnum].text);
- if (MyList[bufnum].text != 0)
+ if (MyList[bufnum].text != NULL)
MyList[bufnum].size = want;
}
result = MyList[bufnum].text;
@@ -72,12 +72,12 @@ _nc_trace_alloc(int bufnum, size_t want)
if (MySize) {
if (MyList) {
while (MySize--) {
- if (MyList[MySize].text != 0) {
+ if (MyList[MySize].text != NULL) {
free(MyList[MySize].text);
}
}
free(MyList);
- MyList = 0;
+ MyList = NULL;
}
MySize = 0;
}
@@ -93,7 +93,7 @@ NCURSES_EXPORT(char *)
_nc_trace_buf(int bufnum, size_t want)
{
char *result = _nc_trace_alloc(bufnum, want);
- if (result != 0)
+ if (result != NULL)
*result = '\0';
return result;
}
@@ -109,12 +109,12 @@ _nc_trace_bufcat(int bufnum, const char *value)
if (value == NULL)
value = "";
buffer = _nc_trace_alloc(bufnum, (size_t) 0);
- if (buffer != 0) {
+ if (buffer != NULL) {
size_t have = strlen(buffer);
size_t need = strlen(value) + have;
buffer = _nc_trace_alloc(bufnum, 1 + need);
- if (buffer != 0)
+ if (buffer != NULL)
_nc_STRCPY(buffer + have, value, need);
}
diff --git a/ncurses/trace/trace_tries.c b/ncurses/trace/trace_tries.c
index 14f704b4abb5..8d2592aa7e66 100644
--- a/ncurses/trace/trace_tries.c
+++ b/ncurses/trace/trace_tries.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2020 Thomas E. Dickey *
+ * Copyright 2020,2024 Thomas E. Dickey *
* Copyright 1999-2011,2012 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -36,7 +36,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: trace_tries.c,v 1.18 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: trace_tries.c,v 1.19 2024/12/07 21:24:18 tom Exp $")
#ifdef TRACE
#define my_buffer _nc_globals.tracetry_buf
@@ -50,8 +50,8 @@ recur_tries(TRIES * tree, unsigned level)
my_buffer = (unsigned char *) _nc_doalloc(my_buffer, my_length);
}
- if (my_buffer != 0) {
- while (tree != 0) {
+ if (my_buffer != NULL) {
+ while (tree != NULL) {
if ((my_buffer[level] = tree->ch) == 0)
my_buffer[level] = 128;
my_buffer[level + 1] = 0;
@@ -69,7 +69,7 @@ recur_tries(TRIES * tree, unsigned level)
NCURSES_EXPORT(void)
_nc_trace_tries(TRIES * tree)
{
- if ((my_buffer = typeMalloc(unsigned char, my_length = 80)) != 0) {
+ if ((my_buffer = typeMalloc(unsigned char, my_length = 80)) != NULL) {
_tracef("BEGIN tries %p", (void *) tree);
recur_tries(tree, 0);
_tracef(". . . tries %p", (void *) tree);
diff --git a/ncurses/trace/varargs.c b/ncurses/trace/varargs.c
index 7b9533bd62f4..4fa38da89ad3 100644
--- a/ncurses/trace/varargs.c
+++ b/ncurses/trace/varargs.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2020,2023 Thomas E. Dickey *
+ * Copyright 2020-2024,2025 Thomas E. Dickey *
* Copyright 2001-2008,2012 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -35,7 +35,7 @@
#include <ctype.h>
-MODULE_ID("$Id: varargs.c,v 1.13 2023/06/24 13:41:46 tom Exp $")
+MODULE_ID("$Id: varargs.c,v 1.16 2025/02/15 15:22:14 tom Exp $")
#ifdef TRACE
@@ -60,35 +60,35 @@ NCURSES_EXPORT(char *)
_nc_varargs(const char *fmt, va_list ap)
{
char buffer[BUFSIZ];
- const char *param;
+ const char *value;
int n;
- if (fmt == 0 || *fmt == '\0')
+ if (fmt == NULL || *fmt == '\0')
return NULL;
if (MyLength == 0)
MyBuffer = typeMalloc(char, MyLength = BUFSIZ);
- if (MyBuffer == 0)
+ if (MyBuffer == NULL)
return NULL;
*MyBuffer = '\0';
while (*fmt != '\0') {
if (*fmt == '%') {
- char *pval = 0; /* avoid const-cast */
+ const char *pval = NULL; /* avoid const-cast */
const char *sval = "";
double fval = 0.0;
int done = FALSE;
int ival = 0;
int type = 0;
- ARGTYPE parm[MAX_PARMS];
- int parms = 0;
+ ARGTYPE param[MAX_PARMS];
+ int params = 0;
ARGTYPE used = atUnknown;
while (*++fmt != '\0' && !done) {
if (*fmt == '*') {
VA_INT(int);
- if (parms < MAX_PARMS)
- parm[parms++] = atInteger;
+ if (params < MAX_PARMS)
+ param[params++] = atInteger;
} else if (isalpha(UChar(*fmt))) {
done = TRUE;
switch (*fmt) {
@@ -141,11 +141,11 @@ _nc_varargs(const char *fmt, va_list ap)
} else if (*fmt == '%') {
done = TRUE;
}
- if (used != atUnknown && parms < MAX_PARMS) {
- parm[parms++] = used;
- for (n = 0; n < parms; ++n) {
- used = parm[n];
- param = buffer;
+ if (used != atUnknown && params < MAX_PARMS) {
+ param[params++] = used;
+ for (n = 0; n < params; ++n) {
+ used = param[n];
+ value = buffer;
switch (used) {
case atInteger:
_nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer))
@@ -160,19 +160,19 @@ _nc_varargs(const char *fmt, va_list ap)
"%p", pval);
break;
case atString:
- param = _nc_visbuf2(1, sval);
+ value = _nc_visbuf2(1, sval);
break;
case atUnknown:
default:
_nc_STRCPY(buffer, "?", sizeof(buffer));
break;
}
- MyLength += strlen(param) + 2;
+ MyLength += strlen(value) + 2;
MyBuffer = typeRealloc(char, MyLength, MyBuffer);
- if (MyBuffer != 0) {
+ if (MyBuffer != NULL) {
_nc_SPRINTF(MyBuffer + strlen(MyBuffer),
_nc_SLIMIT(MyLength - strlen(MyBuffer))
- ", %s", param);
+ ", %s", value);
}
}
}
diff --git a/ncurses/trace/visbuf.c b/ncurses/trace/visbuf.c
index 590e42306f51..2fdd554c5dcb 100644
--- a/ncurses/trace/visbuf.c
+++ b/ncurses/trace/visbuf.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2019-2021,2023 Thomas E. Dickey *
+ * Copyright 2019-2023,2024 Thomas E. Dickey *
* Copyright 2001-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -43,7 +43,7 @@
#include <tic.h>
#include <ctype.h>
-MODULE_ID("$Id: visbuf.c,v 1.54 2023/05/27 20:13:10 tom Exp $")
+MODULE_ID("$Id: visbuf.c,v 1.56 2024/12/07 21:12:53 tom Exp $")
#define NUM_VISBUFS 4
@@ -72,7 +72,7 @@ _nc_vischar(char *tp, unsigned c LIMIT_ARG)
} else if (c == '"' || c == '\\') {
*tp++ = '\\';
*tp++ = (char) c;
- } else if (is7bits((int) c) && (isgraph((int) c) || c == ' ')) {
+ } else if (is7bits(UChar(c)) && (isgraph(UChar(c)) || c == ' ')) {
*tp++ = (char) c;
} else if (c == '\n') {
*tp++ = '\\';
@@ -109,11 +109,11 @@ _nc_vischar(char *tp, unsigned c LIMIT_ARG)
static const char *
_nc_visbuf2n(int bufnum, const char *buf, int len)
{
- const char *vbuf = 0;
+ const char *vbuf = NULL;
char *tp;
int count;
- if (buf == 0)
+ if (buf == NULL)
return ("(null)");
if (buf == CANCELLED_STRING)
return ("(cancelled)");
@@ -140,7 +140,7 @@ _nc_visbuf2n(int bufnum, const char *buf, int len)
}
}
#endif
- if (tp != 0) {
+ if (tp != NULL) {
int c;
*tp++ = D_QUOTE;
@@ -196,7 +196,7 @@ _nc_viswbuf2n(int bufnum, const wchar_t *buf, int len)
char *tp;
int count;
- if (buf == 0)
+ if (buf == NULL)
return ("(null)");
if (len < 0)
@@ -212,7 +212,7 @@ _nc_viswbuf2n(int bufnum, const wchar_t *buf, int len)
vbuf = tp = mybuf[bufnum];
}
#endif
- if (tp != 0) {
+ if (tp != NULL) {
wchar_t c;
*tp++ = D_QUOTE;
@@ -267,12 +267,12 @@ _nc_viswibuf(const wint_t *buf)
}
if (mylen < ++n) {
mylen = n + 80;
- if (mybuf != 0)
+ if (mybuf != NULL)
mybuf = typeRealloc(wchar_t, mylen, mybuf);
else
mybuf = typeMalloc(wchar_t, mylen);
}
- if (mybuf != 0) {
+ if (mybuf != NULL) {
for (n = 0; buf[n] != 0; ++n) {
mybuf[n] = (wchar_t) buf[n];
}
@@ -289,7 +289,7 @@ _nc_viscbuf2(int bufnum, const NCURSES_CH_T *buf, int len)
{
char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
- if (result != 0) {
+ if (result != NULL) {
int first = 0;
#if USE_WIDEC_SUPPORT
@@ -317,7 +317,7 @@ _nc_viscbuf2(int bufnum, const NCURSES_CH_T *buf, int len)
for (j = first; j <= last; ++j) {
const char *found = _nc_altcharset_name(attr, (chtype)
CharOf(buf[j]));
- if (found != 0) {
+ if (found != NULL) {
(void) _nc_trace_bufcat(bufnum, found);
attr &= ~A_ALTCHARSET;
} else