Skip to contentSkip to conversation

0 -> NULL, for arch/um

PATCH Applied Yoann Padioleau 2 participants 3 messages Jul 27, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 18/68 0 -> NULL, for arch/um

When comparing a pointer, it's clearer to compare it to NULL than to 0.

Here is an excerpt of the semantic patch:

@@
expression *E;
@@

E =
- 0
+ NULL

@@
expression *E;
@@

E !- 0
+ NULL

---

 sys-i386/fault.c   |    2 +-
 sys-x86_64/fault.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/um/sys-i386/fault.c +1 -1
index 745b4fd..8004023 100644
@@ -20,7 +20,7 @@ int arch_fixup(unsigned long address, un
 	const struct exception_table_entry *fixup;
 
 	fixup = search_exception_tables(address);
-	if(fixup != 0){
+	if(fixup != NULL){
 		UPT_IP(regs) = fixup->fixup;
 		return(1);
 	}
arch/um/sys-x86_64/fault.c +1 -1
index 4636b14..67d4a19 100644
@@ -19,7 +19,7 @@ int arch_fixup(unsigned long address, un
 	const struct exception_table_entry *fixup;
 
 	fixup = search_exception_tables(address);
-	if(fixup != 0){
+	if(fixup != NULL){
 		UPT_IP(regs) = fixup->fixup;
 		return(1);
 	}
#1 lore raw
Quoted 1 line · Yoann Padioleau

When comparing a pointer, it's clearer to compare it to NULL than to 0.

ACK

Quoted 3 lines
 sys-i386/fault.c   |    2 +-
 sys-x86_64/fault.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Except you should probably diff from the top of the kernel tree.

Jeff

Signature · 1 line
Work email - jdike at linux dot intel dot com
#2 lore raw
Quoted 10 lines · Jeff Dike
Quoted 1 line · Yoann Padioleau

When comparing a pointer, it's clearer to compare it to NULL than to 0.

ACK

Quoted 3 lines
 sys-i386/fault.c   |    2 +-
 sys-x86_64/fault.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Except you should probably diff from the top of the kernel tree.

Sorry. I will use diffstat -p1 from now on.

Quoted 5 lines

Jeff

Signature · 1 line
Work email - jdike at linux dot intel dot com