changeset 34628:ee78c9c66508

Add doxgen comment to gstrncmp(). Additionally, use correct data type for n.
author ib
date Mon, 13 Feb 2012 16:10:39 +0000
parents 3482045da618
children 531c69f090da
files gui/util/string.c gui/util/string.h
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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);