Many places in the code NULL is used in integer context, where
plain 0 should be used. This happens to work because we #define NULL to 0, but is stylistically wrong and can cause problems for people trying to port bits of code to other environments. PR: 2752 Submitted by: Arne Henrik Juul <arnej@imf.unit.no>
This commit is contained in:
parent
4a215352c4
commit
06bba905d0
@ -250,10 +250,10 @@ incard(crd)
|
||||
if (!(line = getline()))
|
||||
goto gotit;
|
||||
p = p1 = line;
|
||||
while (*p1 != ' ' && *p1 != NULL)
|
||||
while (*p1 != ' ' && *p1 != '\0')
|
||||
++p1;
|
||||
*p1++ = NULL;
|
||||
if (*p == NULL)
|
||||
*p1++ = '\0';
|
||||
if (*p == '\0')
|
||||
goto gotit;
|
||||
|
||||
/* IMPORTANT: no real card has 2 char first name */
|
||||
@ -289,17 +289,17 @@ incard(crd)
|
||||
if (rnk == EMPTY)
|
||||
goto gotit;
|
||||
p = p1;
|
||||
while (*p1 != ' ' && *p1 != NULL)
|
||||
while (*p1 != ' ' && *p1 != '\0')
|
||||
++p1;
|
||||
*p1++ = NULL;
|
||||
if (*p == NULL)
|
||||
*p1++ = '\0';
|
||||
if (*p == '\0')
|
||||
goto gotit;
|
||||
if (!strcmp("OF", p)) {
|
||||
p = p1;
|
||||
while (*p1 != ' ' && *p1 != NULL)
|
||||
while (*p1 != ' ' && *p1 != '\0')
|
||||
++p1;
|
||||
*p1++ = NULL;
|
||||
if (*p == NULL)
|
||||
*p1++ = '\0';
|
||||
if (*p == '\0')
|
||||
goto gotit;
|
||||
}
|
||||
sut = EMPTY;
|
||||
@ -348,7 +348,7 @@ number(lo, hi, prompt)
|
||||
|
||||
for (sum = 0;;) {
|
||||
msg(prompt);
|
||||
if (!(p = getline()) || *p == NULL) {
|
||||
if (!(p = getline()) || *p == '\0') {
|
||||
msg(quiet ? "Not a number" :
|
||||
"That doesn't look like a number");
|
||||
continue;
|
||||
@ -363,7 +363,7 @@ number(lo, hi, prompt)
|
||||
++p;
|
||||
}
|
||||
|
||||
if (*p != ' ' && *p != '\t' && *p != NULL)
|
||||
if (*p != ' ' && *p != '\t' && *p != '\0')
|
||||
sum = lo - 1;
|
||||
if (sum >= lo && sum <= hi)
|
||||
break;
|
||||
|
@ -115,7 +115,7 @@ scorehand(hand, starter, n, crb, do_explain)
|
||||
CARD h[(CINHAND + 1)];
|
||||
char buf[32];
|
||||
|
||||
expl[0] = NULL; /* initialize explanation */
|
||||
expl[0] = '\0'; /* initialize explanation */
|
||||
score = 0;
|
||||
flag = TRUE;
|
||||
k = hand[0].suit;
|
||||
@ -131,7 +131,7 @@ scorehand(hand, starter, n, crb, do_explain)
|
||||
}
|
||||
|
||||
if (flag && n >= CINHAND) {
|
||||
if (do_explain && expl[0] != NULL)
|
||||
if (do_explain && expl[0] != '\0')
|
||||
strcat(expl, ", ");
|
||||
if (starter.suit == k) {
|
||||
score += 5;
|
||||
@ -140,13 +140,13 @@ scorehand(hand, starter, n, crb, do_explain)
|
||||
} else
|
||||
if (!crb) {
|
||||
score += 4;
|
||||
if (do_explain && expl[0] != NULL)
|
||||
if (do_explain && expl[0] != '\0')
|
||||
strcat(expl, ", Four-flush");
|
||||
else
|
||||
strcpy(expl, "Four-flush");
|
||||
}
|
||||
}
|
||||
if (do_explain && expl[0] != NULL)
|
||||
if (do_explain && expl[0] != '\0')
|
||||
strcat(expl, ", ");
|
||||
h[n] = starter;
|
||||
sorthand(h, n + 1); /* sort by rank */
|
||||
|
@ -176,9 +176,9 @@ struct id_com_s com_id_tab[COMS] = {
|
||||
'b', "b down & left",
|
||||
'c', "c call object",
|
||||
'n', "n down & right",
|
||||
NULL, "<SHIFT><dir>: run that way",
|
||||
'\0', "<SHIFT><dir>: run that way",
|
||||
')', ") print current weapon",
|
||||
NULL, "<CTRL><dir>: run till adjacent",
|
||||
'\0', "<CTRL><dir>: run till adjacent",
|
||||
']', "] print current armor",
|
||||
'f', "f<dir> fight till death or near death",
|
||||
'=', "= print current rings",
|
||||
|
Loading…
x
Reference in New Issue
Block a user