This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
PATCH : readline/shell/NULL
- To: "Philippe De Muyter" <phdm@macqel.be>
- Subject: PATCH : readline/shell/NULL
- From: Elena Zannoni <ezannoni@cygnus.com>
- Date: Thu, 12 Aug 1999 14:18:13 -0400 (EDT)
- Cc: gdb-patches@sourceware.cygnus.com (gdb-patches@sourceware.cygnus.com)
- References: <199908112358.BAA04080@mail.macqel.be>
I wonder whether it would be better to include something like stdio.h
in this file, or some other header that defines NULL. NULL is used in
several other files in readline, and those work fine for you.
Please cc Chet Ramey as well.
Thanks
Elena
Philippe De Muyter writes:
> Symptom :
>
> gcc -c -DHAVE_CONFIG_H -I. -I/share/src/gnu/gdb-19990809/readline -I/usr/local/include -DRL_LIBRARY_VERSION='"4.0"' -g -O2 -W -Wall /share/src/gnu/gdb-19990809/readline/shell.c
> /share/src/gnu/gdb-19990809/readline/shell.c: In function `get_home_dir':
> /share/src/gnu/gdb-19990809/readline/shell.c:128: `NULL' undeclared (first use this function)
> /share/src/gnu/gdb-19990809/readline/shell.c:128: (Each undeclared identifier is reported only once
> /share/src/gnu/gdb-19990809/readline/shell.c:128: for each function it appears in.)
> /share/src/gnu/gdb-19990809/readline/shell.c:125: warning: `home_dir' may be used uninitialized in this function
> gnumake[1]: *** [shell.o] Error 1
>
> Possible fix :
>
> Thu Aug 12 00:11:02 1999 Philippe De Muyter <phdm@macqel.be>
>
> * shell.c (get_home_dir): Initialize `home_dir' to 0, not NULL.
>
> --- ./readline/shell.c Wed Aug 11 18:42:45 1999
> +++ ./readline/shell.c Wed Aug 11 11:53:22 1999
> @@ -125,7 +125,7 @@ get_home_dir ()
> char *home_dir;
> struct passwd *entry;
>
> - home_dir = (char *)NULL;
> + home_dir = (char *)0;
> entry = getpwuid (getuid ());
> if (entry)
> home_dir = entry->pw_dir;
>
>