Skip to contentSkip to conversation

Module rewrite 6/20: streq

PATCH In review Rusty Russell 2 participants 2 messages Sep 25, 2002 – Sep 26, 2002 Generic string library

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Module rewrite 6/20: streq

Name: streq implementation
Author: Rusty Russell
Status: Trivial
Depends: Misc/strcspn.patch.gz

D: I can't believe that after all these years I still make the "sense
D: of strcmp" mistake. So it's time to reintroduce my favorite macro.

include/linux/string.h +1 -0
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .24879-linux-2.5.38/include/linux/string.h .24879-linux-2.5.38.updated/include/linux/string.h
@@ -16,6 +16,7 @@ extern char * strpbrk(const char *,const
 extern char * strsep(char **,const char *);
 extern __kernel_size_t strspn(const char *,const char *);
 extern __kernel_size_t strcspn(const char *,const char *);
+#define streq(a,b) (strcmp((a),(b)) == 0)
 
 /*
  * Include machine specific inline routines

--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

#1 lore raw
Quoted 7 lines · Rusty Russell

Name: streq implementation
Author: Rusty Russell
Status: Trivial
Depends: Misc/strcspn.patch.gz

D: I can't believe that after all these years I still make the "sense
D: of strcmp" mistake. So it's time to reintroduce my favorite macro.

So you replace something all the competent programmers understand with some weird Rusty specific macro that just makes it harder still for other people to follow kernel code.

Why ?