m4: Misc style fixes

MFC after:	1 week

Reviewed by:	fuz
Differential Revision:	https://reviews.freebsd.org/D55794
This commit is contained in:
Dag-Erling Smørgrav
2026-03-25 01:41:23 +01:00
parent f8f6f1cbd5
commit 41474e78c4
6 changed files with 27 additions and 29 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ int
yyerror(const char *msg) yyerror(const char *msg)
{ {
fprintf(stderr, "m4: %s in expr %s\n", msg, copy_toeval); fprintf(stderr, "m4: %s in expr %s\n", msg, copy_toeval);
return(0); return 0;
} }
int int
+5 -4
View File
@@ -137,8 +137,8 @@ static ndptr
create_entry(const char *name) create_entry(const char *name)
{ {
const char *end = NULL; const char *end = NULL;
unsigned int i;
ndptr n; ndptr n;
unsigned int i;
i = ohash_qlookupi(&macros, name, &end); i = ohash_qlookupi(&macros, name, &end);
n = ohash_find(&macros, i); n = ohash_find(&macros, i);
@@ -156,6 +156,7 @@ void
macro_define(const char *name, const char *defn) macro_define(const char *name, const char *defn)
{ {
ndptr n = create_entry(name); ndptr n = create_entry(name);
if (n->d != NULL) { if (n->d != NULL) {
if (n->d->defn != null) if (n->d->defn != null)
free_definition(n->d->defn); free_definition(n->d->defn);
@@ -183,6 +184,7 @@ void
macro_undefine(const char *name) macro_undefine(const char *name)
{ {
ndptr n = lookup(name); ndptr n = lookup(name);
if (n != NULL) { if (n != NULL) {
struct macro_definition *r, *r2; struct macro_definition *r, *r2;
@@ -306,10 +308,10 @@ static int
string_in_use(const char *ptr) string_in_use(const char *ptr)
{ {
int i; int i;
for (i = 0; i <= sp; i++) {
for (i = 0; i <= sp; i++)
if (sstack[i] == STORAGE_MACRO && mstack[i].sstr == ptr) if (sstack[i] == STORAGE_MACRO && mstack[i].sstr == ptr)
return 1; return 1;
}
return 0; return 0;
} }
@@ -336,4 +338,3 @@ free_definition(char *ptr)
else else
free(ptr); free(ptr);
} }
+1 -2
View File
@@ -388,8 +388,7 @@ macro(void)
CHRSAVE(l); CHRSAVE(l);
} }
} }
} } while (nlpar != 0);
while (nlpar != 0);
} else if (sp < 0 && LOOK_AHEAD(t, scommt)) { } else if (sp < 0 && LOOK_AHEAD(t, scommt)) {
reallyoutputstr(scommt); reallyoutputstr(scommt);
+5 -7
View File
@@ -135,8 +135,7 @@ pbnumbase(int n, int base, int d)
do { do {
pushback(digits[num % base]); pushback(digits[num % base]);
printed++; printed++;
} } while ((num /= base) > 0);
while ((num /= base) > 0);
while (printed++ < d) while (printed++ < d)
pushback('0'); pushback('0');
@@ -153,8 +152,7 @@ pbunsigned(unsigned long n)
{ {
do { do {
pushback(n % 10 + '0'); pushback(n % 10 + '0');
} } while ((n /= 10) > 0);
while ((n /= 10) > 0);
} }
void void
@@ -186,9 +184,9 @@ enlarge_strspace(void)
memcpy(newstrspace, strspace, strsize/2); memcpy(newstrspace, strspace, strsize/2);
for (i = 0; i <= sp; i++) for (i = 0; i <= sp; i++)
if (sstack[i] == STORAGE_STRSPACE) if (sstack[i] == STORAGE_STRSPACE)
mstack[i].sstr = (mstack[i].sstr - strspace) mstack[i].sstr = (mstack[i].sstr - strspace) +
+ newstrspace; newstrspace;
ep = (ep-strspace) + newstrspace; ep = (ep - strspace) + newstrspace;
free(strspace); free(strspace);
strspace = newstrspace; strspace = newstrspace;
endest = strspace + strsize; endest = strspace + strsize;