]> git.meshlink.io Git - catta/blobdiff - avahi-daemon/ini-file-parser.c
l10n: Updates to Spanish (Castilian) (es) translation
[catta] / avahi-daemon / ini-file-parser.c
index 03a3f8b814523580645e65b22600d94bfc3da713..1b50335ba4e0fcbfaac772dfbc4bf9614539ad69 100644 (file)
   USA.
 ***/
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
+#include <ctype.h>
 
 #include <avahi-common/malloc.h>
 #include <avahi-core/log.h>
@@ -155,9 +160,16 @@ char** avahi_split_csv(const char *t) {
     i = r = avahi_new(char*, n_comma+2);
 
     for (;;) {
-        size_t l = strcspn(t, ",");
+        size_t n, l = strcspn(t, ",");
+        const char *c;
+
+        /* Ignore leading blanks */
+        for (c = t, n = l; isblank(*c); c++, n--);
+
+        /* Ignore trailing blanks */
+        for (; n > 0 && isblank(c[n-1]); n--);
 
-        *(i++) = avahi_strndup(t, l);
+        *(i++) = avahi_strndup(c, n);
 
         t += l;