From c43ef2aedd0b2be3236e3e9feced447b956e496c Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 12 Nov 2015 19:42:44 -0500 Subject: [PATCH] We don't need to implement strdup After defining _GNU_SOURCE --- include/stringop.h | 1 - sway/stringop.c | 9 --------- wayland/client.c | 12 ++++++------ 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/include/stringop.h b/include/stringop.h index 49bfa771..febbbaba 100644 --- a/include/stringop.h +++ b/include/stringop.h @@ -33,5 +33,4 @@ char *cmdsep(char **stringp, const char *delim); // Split string into 2 by delim, handle quotes char *argsep(char **stringp, const char *delim); -char *strdup(const char *); #endif diff --git a/sway/stringop.c b/sway/stringop.c index 31a036c3..8d6cac2f 100644 --- a/sway/stringop.c +++ b/sway/stringop.c @@ -362,12 +362,3 @@ char *argsep(char **stringp, const char *delim) { found: return start; } - -char *strdup(const char *str) { - char *dup = malloc(strlen(str) + 1); - if (dup) { - strcpy(dup, str); - } - return dup; -} - diff --git a/wayland/client.c b/wayland/client.c index b5e5b51a..5c5c0751 100644 --- a/wayland/client.c +++ b/wayland/client.c @@ -104,8 +104,8 @@ static int create_pool_file(size_t size) { } static void buffer_release(void *data, struct wl_buffer *buffer) { - struct client_state *state = data; - state->busy = false; + struct client_state *state = data; + state->busy = false; sway_log(L_INFO, "buffer release"); } @@ -138,9 +138,9 @@ struct buffer *create_buffer(struct client_state *state, static void frame_callback(void *data, struct wl_callback *callback, uint32_t time) { sway_log(L_INFO, "frame callback"); - struct client_state *state = data; - wl_callback_destroy(callback); - state->frame_cb = NULL; + struct client_state *state = data; + wl_callback_destroy(callback); + state->frame_cb = NULL; } static const struct wl_callback_listener listener = { @@ -177,7 +177,7 @@ struct client_state *client_setup(void) { int client_prerender(struct client_state *state) { wl_display_dispatch_pending(state->display); - wl_display_flush(state->display); + wl_display_flush(state->display); return 1; }