]> git.sur5r.net Git - i3/i3/blobdiff - src/workspace.c
Merge branch 'master' into next
[i3/i3] / src / workspace.c
index a7a5a7aad6b551b717c3408861d4f0aa0d5a190f..325644598453e98b337f756ccd988fd21dbb3223 100644 (file)
@@ -49,12 +49,12 @@ Con *workspace_get(const char *num, bool *created) {
         workspace->name = sstrdup(num);
         /* We set ->num to the number if this workspace’s name consists only of
          * a positive number. Otherwise it’s a named ws and num will be -1. */
-        char *end;
-        long parsed_num = strtol(num, &end, 10);
+        char *endptr = NULL;
+        long parsed_num = strtol(num, &endptr, 10);
         if (parsed_num == LONG_MIN ||
             parsed_num == LONG_MAX ||
             parsed_num < 0 ||
-            (end && *end != '\0'))
+            endptr == num)
             workspace->num = -1;
         else workspace->num = parsed_num;
         LOG("num = %d\n", workspace->num);