At least on OpenBSD/amd64, this macro returns a bogus value if its argument is NULL.
authorJon Trulson <jon@radscan.com>
Thu, 9 Aug 2012 18:21:43 +0000 (12:21 -0600)
committerJon Trulson <jon@radscan.com>
Thu, 9 Aug 2012 18:21:43 +0000 (12:21 -0600)
Patch from Pascal Stumpf <Pascal.Stumpf@cubes.de>

So check for this first like the other macros in this file do, and
don't cast an istring to int.

cde/programs/dtappbuilder/src/libAButil/istr.h

index fead77a60689991a66d48958d33e27b9f457d61a..358281484f3939b872a7b067046368d9a9ebd5fb 100644 (file)
@@ -272,7 +272,7 @@ extern ISTR_PRIVT_STRN      *istrP_int_array1809065681PrivD;
 #define istr_string_safe(s) ((s) == NULL? Istr_null_string:istr_string(s))
 
 #define istrP_get_string_fast3718930164PrivF(istring) \
-    (istrP_int_array1809065681PrivD[((int)istring)].str)
+    ((istring)==NULL ? Istr_null_string : (istrP_int_array1809065681PrivD[((long)istring)].str))
 
 /* istr_string - if debugging is turned on, checks ISTRINGS for validity */
 #ifdef DEBUG