DragonFly kernel List (threaded) for 2008-06
DragonFly BSD
DragonFly kernel List (threaded) for 2008-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: changing definition of NULL to ((void *)0) for C


From: "Nicolas Thery" <nthery@xxxxxxxxx>
Date: Tue, 3 Jun 2008 12:33:18 +0200

2008/6/2 Sascha Wildner <saw@online.de>:
> Hi all,
>
> the following patch will add <sys/_null.h> which defines NULL as 0 for C++
> and as ((void *)0) for C, similar to FreeBSD. Currently NULL is always 0
> (except for a few things which redefine it).
>
> The remainder of the patch changes our headers to #include <sys/_null.h>
> where NULL was defined previously and fixes a number of warnings which
> cropped up once NULL was void *. It also removes some casts of NULL to void
> * which are currently needed to "fix" the "missing sentinel in function
> call" warnings.
>
> http://leaf.dragonflybsd.org/~swildner/NULL.diff
>
> If no one objects, I'll commit this on Thursday.

That looks like a good thing to me.  You must have spent quite some
time making all these changes!

I reviewed the 1st half only.  I've got only a pedantic remark.  NULL
should be changed to 0 in the following diff :-)

RCS file: /home/dcvs/src/gnu/usr.bin/gdb/kgdb/trgt_i386.c,v
retrieving revision 1.5
diff -u -r1.5 trgt_i386.c
--- gnu/usr.bin/gdb/kgdb/trgt_i386.c	14 Jan 2008 21:36:38 -0000	1.5
+++ gnu/usr.bin/gdb/kgdb/trgt_i386.c	1 Jun 2008 02:24:14 -0000
@@ -63,7 +63,7 @@
 	/*
 	 * kt->pcb == NULL is a marker for "non-dumping kernel thread".
 	 */
-	if (kt->pcb == NULL) {
+	if (kt->pcb == 0) {
 		uintptr_t regs[5];
 		uintptr_t addr;
 		uintptr_t sp;

Cheers,
Nicolas



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]