mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
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>
This commit is contained in:
parent
6cf5e8f932
commit
6c49a8f7e5
1 changed files with 1 additions and 19 deletions
|
|
@ -229,24 +229,6 @@ xcursor_images_destroy(struct xcursor_images *images)
|
||||||
free(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
|
static bool
|
||||||
xcursor_read_uint(FILE *file, uint32_t *u)
|
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);
|
images = xcursor_xc_file_load_images(f, size);
|
||||||
|
|
||||||
if (images) {
|
if (images) {
|
||||||
xcursor_images_set_name(images, ent->d_name);
|
images->name = strdup(ent->d_name);
|
||||||
load_callback(images, user_data);
|
load_callback(images, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue