From c6cf0d32b99c5c63f191596dca616a0f791ddfbf Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Fri, 1 May 2020 01:13:12 +0200 Subject: [PATCH] placeholder_t: Make char*s const Similarly to https://github.com/i3/i3status/pull/412 --- include/libi3.h | 4 ++-- src/con.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/libi3.h b/include/libi3.h index 85a8afe3..56da86fb 100644 --- a/include/libi3.h +++ b/include/libi3.h @@ -543,9 +543,9 @@ int mkdirp(const char *path, mode_t mode); /** Helper structure for usage in format_placeholders(). */ typedef struct placeholder_t { /* The placeholder to be replaced, e.g., "%title". */ - char *name; + const char *name; /* The value this placeholder should be replaced with. */ - char *value; + const char *value; } placeholder_t; /** diff --git a/src/con.c b/src/con.c index c2da3cbb..645d1448 100644 --- a/src/con.c +++ b/src/con.c @@ -2318,11 +2318,11 @@ i3String *con_parse_title_format(Con *con) { char *formatted_str = format_placeholders(con->title_format, &placeholders[0], num); i3String *formatted = i3string_from_utf8(formatted_str); i3string_set_markup(formatted, pango_markup); - FREE(formatted_str); - for (size_t i = 0; i < num; i++) { - FREE(placeholders[i].value); - } + free(formatted_str); + free(title); + free(class); + free(instance); return formatted; }