linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] streq()
@ 2002-09-24  4:49 Rusty Russell
  2002-09-24  5:40 ` Ingo Molnar
  2002-09-25 11:27 ` Daniel Egger
  0 siblings, 2 replies; 13+ messages in thread
From: Rusty Russell @ 2002-09-24  4:49 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

Embarrassing, huh?  But I just found a bug in my code cause by
"if (strcmp(a,b))" instead of "if (!strcmp(a,b))".

This bites me about once a year, so Linus, please apply.

Preparing to have my "3l33t k3rN31 h@ck3r" card revoked,
Rusty.

Name: streq implementation
Author: Rusty Russell
Status: Trivial

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.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.38/include/linux/string.h working-2.5.38-streq/include/linux/string.h
--- linux-2.5.38/include/linux/string.h	2002-06-06 21:38:40.000000000 +1000
+++ working-2.5.38-streq/include/linux/string.h	2002-09-24 14:43:30.000000000 +1000
@@ -15,7 +15,7 @@ extern "C" {
 extern char * strpbrk(const char *,const char *);
 extern char * strsep(char **,const char *);
 extern __kernel_size_t strspn(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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2002-09-25 13:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-24  4:49 [PATCH] streq() Rusty Russell
2002-09-24  5:40 ` Ingo Molnar
2002-09-24  6:04   ` Rusty Russell
2002-09-24  6:24     ` David S. Miller
2002-09-24  7:28       ` Rusty Russell
2002-09-24  7:38         ` Ingo Molnar
2002-09-24  8:19         ` David S. Miller
2002-09-24 13:07   ` Denis Vlasenko
2002-09-24 17:21   ` H. Peter Anvin
2002-09-25 11:27 ` Daniel Egger
2002-09-25 11:45   ` Russell King
2002-09-25 12:38     ` Daniel Egger
2002-09-25 12:19   ` Michael Sinz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).