Просмотр исходного кода

libdpkg: Use isblank instead of ad-hoc comparisons

Guillem Jover лет назад: 17
Родитель
Сommit
896b469211
1 измененных файлов с 6 добавлено и 3 удалено
  1. 6 3
      lib/parsehelp.c

+ 6 - 3
lib/parsehelp.c

@@ -221,14 +221,17 @@ const char *parseversion(struct versionrevision *rversion, const char *string) {
   if (!*string) return _("version string is empty");
 
   /* trim leading and trailing space */
-  while (*string && (*string == ' ' || *string == '\t') ) string++;
+  while (*string && isblank(*string))
+    string++;
   /* string now points to the first non-whitespace char */
   end = string;
   /* find either the end of the string, or a whitespace char */
-  while (*end && *end != ' ' && *end != '\t' ) end++;
+  while (*end && !isblank(*end))
+    end++;
   /* check for extra chars after trailing space */
   ptr = end;
-  while (*ptr && ( *ptr == ' ' || *ptr == '\t' ) ) ptr++;
+  while (*ptr && isblank(*ptr))
+    ptr++;
   if (*ptr) return _("version string has embedded spaces");
 
   colon= strchr(string,':');