# HG changeset patch # User ib # Date 1329149439 0 # Node ID ee78c9c66508d5b97e57c15e2791c38c7faacac6 # Parent 3482045da618c2229052af3a917cd42cb82c6f3a Add doxgen comment to gstrncmp(). Additionally, use correct data type for n. diff -r 3482045da618 -r ee78c9c66508 gui/util/string.c --- a/gui/util/string.c Mon Feb 13 16:01:55 2012 +0000 +++ b/gui/util/string.c Mon Feb 13 16:10:39 2012 +0000 @@ -173,7 +173,16 @@ return strcasecmp(a, b); } -int gstrncmp(const char *a, const char *b, int n) +/** + * @brief A strncmp() that can handle NULL pointers. + * + * @param a string to be compared + * @param b string which is compared + * @param n number of characters compared at the most + * + * @return return value of strncmp() or -1, if a or b are NULL + */ +int gstrncmp(const char *a, const char *b, size_t n) { if (!a && !b) return 0; diff -r 3482045da618 -r ee78c9c66508 gui/util/string.h --- a/gui/util/string.h Mon Feb 13 16:01:55 2012 +0000 +++ b/gui/util/string.h Mon Feb 13 16:10:39 2012 +0000 @@ -27,7 +27,7 @@ char *gstrchr(const char *str, int c); int gstrcmp(const char *a, const char *b); char *gstrdup(const char *str); -int gstrncmp(const char *a, const char *b, int n); +int gstrncmp(const char *a, const char *b, size_t n); void setddup(char **old, const char *dir, const char *name); void setdup(char **old, const char *str); char *strlower(char *in);