clear up some warnings appearing with gcc 15.2.0
allmain.c: In function ‘debug_fields’:
allmain.c:1133:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
1133 | while ((op = strchr(opts, ',')) != 0) {
| ^
cfgfiles.c: In function ‘find_optparam’:
cfgfiles.c:590:10: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
590 | bufp = strchr(buf, '=');
| ^
cfgfiles.c:591:10: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
591 | altp = strchr(buf, ':');
| ^
end.c: In function ‘should_query_disclose_option’:
end.c:482:14: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
482 | if ((dop = strchr(disclosure_options, category)) != 0) {
| ^
invent.c: In function ‘loot_classify’:
invent.c:175:7: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
175 | p = strchr(classorder, oclass);
| ^
o_init.c: In function ‘dodiscovered’:
o_init.c:774:33: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
774 | if (!flags.discosort || !(p = strchr(disco_order_let, flags.discosort)))
| ^
o_init.c: In function ‘doclassdisco’:
o_init.c:907:33: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
907 | if (!flags.discosort || !(p = strchr(disco_order_let, flags.discosort)))
| ^
objnam.c: In function ‘the’:
objnam.c:2200:19: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
2200 | if (((tmp = strrchr(str, ' ')) != 0 || (tmp = strrchr(str, '-')) != 0)
| ^
objnam.c:2200:53: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
2200 | if (((tmp = strrchr(str, ' ')) != 0 || (tmp = strrchr(str, '-')) != 0)
| ^
options.c: In function ‘optfn_disclose’:
options.c:1529:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
1529 | dop = strchr(disclosure_options, c);
| ^
pager.c: In function ‘add_cmap_descr’:
pager.c:1212:28: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
1212 | || ((p = strchr(x_str, ' ')) != 0 && !strcmpi(p, " ice"))
| ^
This commit is contained in:
16
src/o_init.c
16
src/o_init.c
@@ -764,9 +764,10 @@ int
|
||||
dodiscovered(void) /* free after Robert Viduya */
|
||||
{
|
||||
winid tmpwin;
|
||||
char *s, *p, oclass, prev_class,
|
||||
char *s, oclass, prev_class,
|
||||
classes[MAXOCLASSES], buf[BUFSZ],
|
||||
*sorted_lines[NUM_OBJECTS]; /* overkill */
|
||||
const char *p;
|
||||
int i, dis, ct, uniq_ct, arti_ct, sorted_ct, uidx;
|
||||
long sortindx; // should be ptrdiff_t, but we don't require that exists
|
||||
boolean alphabetized, alphabyclass, lootsort;
|
||||
@@ -897,9 +898,10 @@ doclassdisco(void)
|
||||
winid tmpwin = WIN_ERR;
|
||||
menu_item *pick_list = 0;
|
||||
anything any;
|
||||
char *p, *s, c, oclass, menulet, allclasses[MAXOCLASSES],
|
||||
char *s, c, oclass, menulet, allclasses[MAXOCLASSES],
|
||||
discosyms[3 + MAXOCLASSES + 1], buf[BUFSZ],
|
||||
*sorted_lines[NUM_OBJECTS]; /* overkill */
|
||||
const char *p;
|
||||
int i, ct, dis, xtras, sorted_ct, uidx;
|
||||
boolean traditional, alphabetized, lootsort;
|
||||
int clr = NO_COLOR;
|
||||
@@ -1105,12 +1107,14 @@ doclassdisco(void)
|
||||
} else if (sorted_ct) {
|
||||
qsort(sorted_lines, sorted_ct, sizeof (char *), discovered_cmp);
|
||||
for (i = 0; i < sorted_ct; ++i) {
|
||||
p = sorted_lines[i];
|
||||
char *sl;
|
||||
|
||||
sl = sorted_lines[i];
|
||||
if (lootsort) {
|
||||
p[6] = p[0]; /* '*' or ' ' */
|
||||
p += 6;
|
||||
sl[6] = sl[0]; /* '*' or ' ' */
|
||||
sl += 6;
|
||||
}
|
||||
putstr(tmpwin, 0, p);
|
||||
putstr(tmpwin, 0, sl);
|
||||
free(sorted_lines[i]), sorted_lines[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user