Change `(foo *)0'' to `NULL'' where it's possible

(and it appears possible throughout ftpd(8) source.)

It is not a mere issue of style: Null pointers in C
seem to have been mistaken one way or another quite often.
This commit is contained in:
Yaroslav Tykhiy 2004-07-31 15:03:17 +00:00
parent 0e519c96ef
commit aa5a9d3fff
2 changed files with 11 additions and 11 deletions

View File

@ -106,7 +106,7 @@ static int cmd_form;
static int cmd_bytesz;
static int state;
char cbuf[512];
char *fromname = (char *) 0;
char *fromname = NULL;
extern int epsvall;
@ -159,7 +159,7 @@ cmd_list
{
if (fromname)
free(fromname);
fromname = (char *) 0;
fromname = NULL;
restart_point = 0;
}
| cmd_list rcmd
@ -455,7 +455,7 @@ cmd
if (noretr || (guest && noguestretr))
reply(500, "RETR command is disabled");
else if ($2 && $4 != NULL)
retrieve((char *) 0, $4);
retrieve(NULL, $4);
if ($4 != NULL)
free($4);
@ -522,7 +522,7 @@ cmd
if (fromname) {
renamecmd(fromname, $4);
free(fromname);
fromname = (char *) 0;
fromname = NULL;
} else {
reply(503, "Bad sequence of commands.");
}
@ -550,7 +550,7 @@ cmd
}
| HELP CRLF
{
help(cmdtab, (char *) 0);
help(cmdtab, NULL);
}
| HELP SP STRING CRLF
{
@ -563,7 +563,7 @@ cmd
if (*cp)
help(sitetab, cp);
else
help(sitetab, (char *) 0);
help(sitetab, NULL);
} else
help(cmdtab, $3);
free($3);
@ -598,7 +598,7 @@ cmd
}
| SITE SP HELP CRLF
{
help(sitetab, (char *) 0);
help(sitetab, NULL);
}
| SITE SP HELP SP STRING CRLF
{
@ -771,7 +771,7 @@ rcmd
if ($2 && $4) {
if (fromname)
free(fromname);
fromname = (char *) 0;
fromname = NULL;
if (renamefrom($4))
fromname = $4;
else
@ -785,7 +785,7 @@ rcmd
if ($2) {
if (fromname)
free(fromname);
fromname = (char *) 0;
fromname = NULL;
restart_point = $4.o;
reply(350, "Restarting at %jd. %s",
(intmax_t)restart_point,
@ -1556,7 +1556,7 @@ help(struct tab *ctab, char *s)
}
upper(s);
c = lookup(ctab, s);
if (c == (struct tab *)0) {
if (c == NULL) {
reply(502, "Unknown command %s.", s);
return;
}

View File

@ -1910,7 +1910,7 @@ dataconn(char *name, off_t size, char *mode)
if ((flags = fcntl(pdata, F_GETFL, 0)) == -1 ||
fcntl(pdata, F_SETFL, flags | O_NONBLOCK) == -1)
goto pdata_err;
if (select(pdata+1, &set, (fd_set *) 0, (fd_set *) 0, &timeout) <= 0 ||
if (select(pdata+1, &set, NULL, NULL, &timeout) <= 0 ||
(s = accept(pdata, (struct sockaddr *) &from, &fromlen)) < 0)
goto pdata_err;
(void) close(pdata);