summaryrefslogtreecommitdiffstats
path: root/lib/colors.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/colors.c')
-rw-r--r--lib/colors.c10
1 files changed, 4 insertions, 6 deletions
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;