From 8bb05ac73a5b448b339ce0bc8d396c82c459b47f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 21:33:32 +0200 Subject: Merging upstream version 2.40. Signed-off-by: Daniel Baumann --- lib/colors.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/colors.c') diff --git a/lib/colors.c b/lib/colors.c index 532e339..0928770 100644 --- a/lib/colors.c +++ b/lib/colors.c @@ -357,12 +357,10 @@ static char *colors_get_homedir(char *buf, size_t bufsz) /* * Adds one color sequence to array with color scheme. - * When returning success (0) this function takes ownership of - * @seq and @name, which have to be allocated strings. */ static int colors_add_scheme(struct ul_color_ctl *cc, - char *name, - char *seq0) + const char *name, + const char *seq0) { struct ul_color_scheme *cs = NULL; char *seq = NULL; @@ -380,8 +378,8 @@ static int colors_add_scheme(struct ul_color_ctl *cc, /* enlarge the array */ if (cc->nschemes == cc->schemes_sz) { - void *tmp = realloc(cc->schemes, (cc->nschemes + 10) - * sizeof(struct ul_color_scheme)); + void *tmp = reallocarray(cc->schemes, cc->nschemes + 10, + sizeof(struct ul_color_scheme)); if (!tmp) goto err; cc->schemes = tmp; -- cgit v1.2.3