debug: convert K&R function definitions to ANSI C

Convert the old-style (K&R) function definitions in debug/ to ANSI C
prototypes, formatted in the project's convention: the return type on its
own line and each parameter on its own line, indented four spaces, with
the original parameter comments retained.

Corrects the HistCreate / HistAdd declarations in debug.h to use bool
for the ptrKeys parameter, matching their definitions.

Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Andreas Wendleder 2026-06-10 03:49:16 +02:00
parent c74eaf4ee8
commit 132155c942
No known key found for this signature in database
GPG Key ID: 588785BFDFB01ABD
3 changed files with 30 additions and 30 deletions

View File

@ -68,8 +68,8 @@ extern struct debugClient debugClients[];
#define DebugIsSet(cid, f) debugClients[(spointertype) cid].dc_flags[f].df_value #define DebugIsSet(cid, f) debugClients[(spointertype) cid].dc_flags[f].df_value
/* procedures */ /* procedures */
extern void HistCreate(const char *name, int ptrKeys, int low, int step, int bins); extern void HistCreate(const char *name, bool ptrKeys, int low, int step, int bins);
extern void HistAdd(const char *name, int ptrKeys, int value); extern void HistAdd(const char *name, bool ptrKeys, int value);
extern void HistPrint(const char *name); extern void HistPrint(const char *name);
extern ClientData DebugAddClient(const char *name, int maxflags); extern ClientData DebugAddClient(const char *name, int maxflags);
extern int DebugAddFlag(ClientData clientID, const char *name); extern int DebugAddFlag(ClientData clientID, const char *name);

View File

@ -56,9 +56,9 @@ int debugNumClients = 0;
*/ */
ClientData ClientData
DebugAddClient(name, maxflags) DebugAddClient(
const char *name; const char *name,
int maxflags; int maxflags)
{ {
struct debugClient *dc; struct debugClient *dc;
@ -112,9 +112,9 @@ DebugAddClient(name, maxflags)
*/ */
int int
DebugAddFlag(clientID, name) DebugAddFlag(
ClientData clientID; /* Client identifier from DebugAddClient */ ClientData clientID, /* Client identifier from DebugAddClient */
const char *name; /* Name of debugging flag */ const char *name) /* Name of debugging flag */
{ {
int id = (int) CD2INT(clientID); int id = (int) CD2INT(clientID);
struct debugClient *dc; struct debugClient *dc;
@ -156,8 +156,8 @@ DebugAddFlag(clientID, name)
*/ */
void void
DebugShow(clientID) DebugShow(
ClientData clientID; ClientData clientID)
{ {
int id = (int) CD2INT(clientID); int id = (int) CD2INT(clientID);
struct debugClient *dc; struct debugClient *dc;
@ -195,11 +195,11 @@ DebugShow(clientID)
*/ */
void void
DebugSet(clientID, argc, argv, value) DebugSet(
ClientData clientID; ClientData clientID,
int argc; int argc,
char *argv[]; char *argv[],
bool value; int value)
{ {
bool badFlag = FALSE; bool badFlag = FALSE;
int id = (int) CD2INT(clientID); int id = (int) CD2INT(clientID);

View File

@ -50,9 +50,9 @@ Histogram * hist_list = (Histogram *) NULL;
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
Histogram * Histogram *
histFind(name, ptrKeys) histFind(
const char * name; const char * name,
bool ptrKeys; bool ptrKeys)
{ {
Histogram * h; Histogram * h;
for(h=hist_list; h!=(Histogram *) NULL; h=h->hi_next) for(h=hist_list; h!=(Histogram *) NULL; h=h->hi_next)
@ -81,12 +81,12 @@ histFind(name, ptrKeys)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
void void
HistCreate(name, ptrKeys, low, step, bins) HistCreate(
const char * name; /* Name for histogram add and print */ const char * name, /* Name for histogram add and print */
bool ptrKeys; /* TRUE if name is a character pointer*/ bool ptrKeys, /* TRUE if name is a character pointer*/
int low; /* The lowest value for the histogram */ int low, /* The lowest value for the histogram */
int step; /* The increment for each bin */ int step, /* The increment for each bin */
int bins; /* The numbe of bins in the histogram */ int bins) /* The numbe of bins in the histogram */
{ {
Histogram * new; Histogram * new;
int i; int i;
@ -134,10 +134,10 @@ HistCreate(name, ptrKeys, low, step, bins)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
void void
HistAdd(name, ptrKeys, value) HistAdd(
const char * name; /* Identifier for the histogram */ const char * name, /* Identifier for the histogram */
bool ptrKeys; /* TRUE if the name is a pointer*/ bool ptrKeys, /* TRUE if the name is a pointer*/
int value; /* Value to index the column */ int value) /* Value to index the column */
{ {
Histogram * h; Histogram * h;
@ -176,8 +176,8 @@ HistAdd(name, ptrKeys, value)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
void void
HistPrint(name) HistPrint(
const char * name; const char * name)
{ {
FILE * fp, * fopen(); FILE * fp, * fopen();
Histogram * h; Histogram * h;