diff options
author | Simon Ser <contact@emersion.fr> | 2022-05-27 17:07:08 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-05-27 22:41:11 +0200 |
commit | 6c49a8f7e508ad51a913f6205b9359dec8132296 (patch) | |
tree | 13bb4e5684c144380883e4fb48dcd9d918457c7a | |
parent | 6cf5e8f9324095f2226ee666eee9090fbc6da287 (diff) |
cursor: drop xcursor_images_set_name
We don't ever need to set the name multiple times for a single
struct xcursor_images, so we can just set the field directly. Also
replace the hand-rolled logic with strdup.
Signed-off-by: Simon Ser <contact@emersion.fr>
-rw-r--r-- | cursor/xcursor.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/cursor/xcursor.c b/cursor/xcursor.c index 315fe00..dcebaee 100644 --- a/cursor/xcursor.c +++ b/cursor/xcursor.c @@ -229,24 +229,6 @@ xcursor_images_destroy(struct xcursor_images *images) free(images); } -static void -xcursor_images_set_name(struct xcursor_images *images, const char *name) -{ - char *new; - - if (!images || !name) - return; - - new = malloc(strlen(name) + 1); - - if (!new) - return; - - strcpy(new, name); - free(images->name); - images->name = new; -} - static bool xcursor_read_uint(FILE *file, uint32_t *u) { @@ -784,7 +766,7 @@ load_all_cursors_from_dir(const char *path, int size, images = xcursor_xc_file_load_images(f, size); if (images) { - xcursor_images_set_name(images, ent->d_name); + images->name = strdup(ent->d_name); load_callback(images, user_data); } |