]> git.sur5r.net Git - i3/i3/blobdiff - src/window.c
Use safe wrappers wherever possible
[i3/i3] / src / window.c
index 7b0f397d5d05fee52efdd2f32ae60e23ed20825e..764cfca5a98267a2f6ae8467aebd9a6d025b66d3 100644 (file)
@@ -208,13 +208,8 @@ void window_update_role(i3Window *win, xcb_get_property_reply_t *prop, bool befo
     }
 
     char *new_role;
-    if (asprintf(&new_role, "%.*s", xcb_get_property_value_length(prop),
-                 (char *)xcb_get_property_value(prop)) == -1) {
-        perror("asprintf()");
-        DLOG("Could not get WM_WINDOW_ROLE\n");
-        free(prop);
-        return;
-    }
+    sasprintf(&new_role, "%.*s", xcb_get_property_value_length(prop),
+              (char *)xcb_get_property_value(prop));
     FREE(win->role);
     win->role = new_role;
     LOG("WM_WINDOW_ROLE changed to \"%s\"\n", win->role);
@@ -241,7 +236,7 @@ void window_update_type(i3Window *window, xcb_get_property_reply_t *reply) {
     }
 
     window->window_type = new_type;
-    LOG("_NET_WM_WINDOW_TYPE changed to %i", window->window_type);
+    LOG("_NET_WM_WINDOW_TYPE changed to %i.\n", window->window_type);
 
     run_assignments(window);
 }