some more discarded-qualifiers fixes

This commit is contained in:
nhmall
2026-04-04 07:52:06 -04:00
parent 9bdc41b263
commit 7120a7190e
4 changed files with 22 additions and 16 deletions
+4 -2
View File
@@ -394,8 +394,10 @@ $(TARGETPFX)sf-version.o: ../src/version.c $(HACK_H)
$(TARGETPFX)sf-worm.o: ../src/worm.c $(HACK_H) $(TARGETPFX)sf-worm.o: ../src/worm.c $(HACK_H)
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/worm.c $(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/worm.c
sftags: sftags.o $(HACKLIB) sftags: sftags.o $(HACKLIB) $(TARGETPFX)sf-alloc.o $(TARGETPFX)panic.o
$(CLINK) $(LFLAGS) -o $@ sftags.o $(HACKLIB) $(LIBS) $(CLINK) $(LFLAGS) -o $@ sftags.o \
$(TARGETPFX)sf-alloc.o $(TARGETPFX)panic.o \
$(HACKLIB) $(LIBS)
sftags.o: sftags.c $(HACK_H) sftags.o: sftags.c $(HACK_H)
$(CC) $(CFLAGS) -c sftags.c $(CC) $(CFLAGS) -c sftags.c
../include/sfproto.h: sf.tags sftags ../include/sfproto.h: sf.tags sftags
+4 -2
View File
@@ -2649,8 +2649,10 @@ $(OUTL)sf-sys.o: $(SRC)sys.c $(HACK_H)
$(OUTL)sf-windsys.o: $(MSWSYS)windsys.c $(HACK_H) $(OUTL)sf-windsys.o: $(MSWSYS)windsys.c $(HACK_H)
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(MSWSYS)windsys.c $(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(MSWSYS)windsys.c
$(UTIL)sftags.exe: $(OUTL)sftags.o $(OUTLHACKLIB) $(UTIL)sftags.exe: $(OUTL)sftags.o $(OUTL)sf-alloc.o $(OUTL)panic.o $(OUTLHACKLIB)
$(link) $(LFLAGS) /OUT:$@ $(OUTL)sftags.o $(OUTLHACKLIB) $(link) $(LFLAGS) /OUT:$@ $(OUTL)sftags.o \
$(OUTL)sf-alloc.o $(OUTL)panic.o \
$(OUTLHACKLIB)
$(OUTL)sftags.o: $(UTIL)sftags.c $(HACK_H) $(OUTL)sftags.o: $(UTIL)sftags.c $(HACK_H)
$(Q)$(CC) $(CFLAGS) -Fo$@ -c $(UTIL)sftags.c $(Q)$(CC) $(CFLAGS) -Fo$@ -c $(UTIL)sftags.c
$(INCL)sfproto.h: $(UTIL)sftags.exe $(UTIL)sf.tags $(INCL)sfproto.h: $(UTIL)sftags.exe $(UTIL)sf.tags
+4 -4
View File
@@ -96,7 +96,7 @@ int util_strncmpi(const char *s1, const char *s2, size_t sz);
#ifdef UNIX #ifdef UNIX
#define nethack_exit exit #define nethack_exit exit
ATTRNORETURN void nh_terminate(int) NORETURN; /* bwrite() calls this */ ATTRNORETURN void nh_terminate(int) NORETURN; /* bwrite() calls this */
static void chdirx(const char *); static void chdirx(const char *, boolean);
#else #else
ATTRNORETURN extern void nethack_exit(int) NORETURN; ATTRNORETURN extern void nethack_exit(int) NORETURN;
#ifdef WIN32 #ifdef WIN32
@@ -184,7 +184,7 @@ main(int argc, char *argv[])
folderbuf[1] = '/'; folderbuf[1] = '/';
folderbuf[2] = '\0'; folderbuf[2] = '\0';
#ifdef CHDIR #ifdef CHDIR
chdirx(HACKDIR); chdirx(HACKDIR, FALSE);
#endif #endif
#endif #endif
#ifdef UNIX #ifdef UNIX
@@ -809,8 +809,8 @@ nethack_exit(int code)
#ifdef UNIX #ifdef UNIX
#ifdef CHDIR #ifdef CHDIR
static void void
chdirx(const char *dir) chdirx(const char *dir, boolean wr UNUSED)
{ {
if (dir) { if (dir) {
#ifdef SECURE #ifdef SECURE
+10 -8
View File
@@ -548,8 +548,8 @@ static void parseExtensionFields (struct tagstruct *tmptag, char *buf)
if (colon == (char *)0) { if (colon == (char *)0) {
tmptag->tagtype = *field; tmptag->tagtype = *field;
} else { } else {
const char *key = field; char *key = field;
const char *value = colon + 1; char *value = colon + 1;
*colon = '\0'; *colon = '\0';
if ((strcmp (key, "struct") == 0) || if ((strcmp (key, "struct") == 0) ||
(strcmp (key, "union") == 0)) { (strcmp (key, "union") == 0)) {
@@ -1844,14 +1844,15 @@ static char *
bfsize(const char *str) bfsize(const char *str)
{ {
static char buf[128]; static char buf[128];
const char *c1; char *copy_str, *c1, *c2, *subst;
char *c2, *subst; char *retval = buf;
if (!str) if (!str)
return (char *)0; return (char *)0;
copy_str = dupstr(str);
/* kludge */ /* kludge */
subst = strstr(str, ",$/"); subst = strstr(copy_str, ",$/");
if (subst != 0) { if (subst != 0) {
subst++; subst++;
*subst++ = ' '; *subst++ = ' ';
@@ -1859,7 +1860,7 @@ bfsize(const char *str)
} }
c2 = buf; c2 = buf;
c1 = str; c1 = copy_str;
while (*c1) { while (*c1) {
if (*c1 == ',') if (*c1 == ',')
break; break;
@@ -1873,9 +1874,10 @@ bfsize(const char *str)
} }
*c2 = '\0'; *c2 = '\0';
} else { } else {
return (char *)0; retval = (char *) 0;
} }
return buf; free((genericptr_t) copy_str);
return retval;
} }
/* Read one line from input, up to and including the next newline /* Read one line from input, up to and including the next newline