diff options
author | Richard Stallman <rms@gnu.org> | 1993-11-05 20:32:06 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-11-05 20:32:06 +0000 |
commit | 6c8747b19a6eaef778e79a05c03e738677e987b5 (patch) | |
tree | be1ebac9443648ecddc31c5a9aa0b1cdd391b815 /gcc/objc | |
parent | c35a847ec5e47fa5cf03359a2c0da27fe5f1eb0f (diff) | |
download | gcc-6c8747b19a6eaef778e79a05c03e738677e987b5.zip gcc-6c8747b19a6eaef778e79a05c03e738677e987b5.tar.gz gcc-6c8747b19a6eaef778e79a05c03e738677e987b5.tar.bz2 |
(compare_strings): Check for null pointers.
From-SVN: r6014
Diffstat (limited to 'gcc/objc')
-rw-r--r-- | gcc/objc/hash.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/objc/hash.h b/gcc/objc/hash.h index e054e7d..2b9ea24 100644 --- a/gcc/objc/hash.h +++ b/gcc/objc/hash.h @@ -193,7 +193,12 @@ compare_ptrs (const void *k1, const void *k2) static inline int compare_strings (const void *k1, const void *k2) { - return !strcmp (k1, k2); + if (k1 == k2) + return 1; + else if (k1 == 0 || k2 == 0) + return 0; + else + return !strcmp (k1, k2); } |