]> git.sur5r.net Git - i3/i3/blobdiff - src/util.c
use size_t for strspn() return value
[i3/i3] / src / util.c
index 877017578074b08ceab583fd092559480a817fb1..c3336e159a1e1bbddb8ffb69441c92ec9a0d2535 100644 (file)
@@ -130,7 +130,7 @@ char *resolve_tilde(const char *path) {
         char *head, *tail, *result;
 
         tail = strchr(path, '/');
-        head = strndup(path, tail ? tail - path : strlen(path));
+        head = strndup(path, tail ? (size_t)(tail - path) : strlen(path));
 
         int res = glob(head, GLOB_TILDE, NULL, &globbuf);
         free(head);
@@ -188,22 +188,14 @@ static char **append_argument(char **original, char *argument) {
 
 char *store_restart_layout(void) {
     setlocale(LC_NUMERIC, "C");
-#if YAJL_MAJOR >= 2
     yajl_gen gen = yajl_gen_alloc(NULL);
-#else
-    yajl_gen gen = yajl_gen_alloc(NULL, NULL);
-#endif
 
     dump_node(gen, croot, true);
 
     setlocale(LC_NUMERIC, "");
 
     const unsigned char *payload;
-#if YAJL_MAJOR >= 2
     size_t length;
-#else
-    unsigned int length;
-#endif
     y(get_buf, &payload, &length);
 
     /* create a temporary file if one hasn't been specified, or just
@@ -241,11 +233,7 @@ char *store_restart_layout(void) {
             return NULL;
         }
         written += n;
-#if YAJL_MAJOR >= 2
         DLOG("written: %zd of %zd\n", written, length);
-#else
-        DLOG("written: %d of %d\n", written, length);
-#endif
     }
     close(fd);