diff options
author | Gerald Combs <gerald@wireshark.org> | 2009-02-17 23:15:35 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2009-02-17 23:15:35 +0000 |
commit | 95ddd62076702f852171c45310176bd364504e5c (patch) | |
tree | 1e3d150da91b385a2687d42db7333a849bf520ba /epan/strutil.h | |
parent | f490cdd7fc936bcce0f9db042a22737117b7cfe2 (diff) |
Add a string utility function "string_or_null" which can be used to
guarantee a non-null string value. Use it in the LDAP dissector. Fixes
the crash on Windows (and other platforms) reported in bug 3262.
svn path=/trunk/; revision=27478
Diffstat (limited to 'epan/strutil.h')
-rw-r--r-- | epan/strutil.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/epan/strutil.h b/epan/strutil.h index 8b12ee5059..3499afc59f 100644 --- a/epan/strutil.h +++ b/epan/strutil.h @@ -215,4 +215,11 @@ char * convert_string_case(const char *string, gboolean case_insensitive); */ char * epan_strcasestr(const char *haystack, const char *needle); +/** Guarantee a non-null string. + * + * @param string The string to check + * @return A pointer 'string' if it's non-null, otherwise "[NULL]". + */ +const char * string_or_null(const char *string); + #endif /* __STRUTIL_H__ */ |