placeholder_t: Make char*s const

Similarly to https://github.com/i3/i3status/pull/412
This commit is contained in:
Orestis Floros 2020-05-01 01:13:12 +02:00
parent 5f9cbb12b8
commit c6cf0d32b9
No known key found for this signature in database
GPG Key ID: A09DBD7D3222C1C3
2 changed files with 6 additions and 6 deletions

View File

@ -543,9 +543,9 @@ int mkdirp(const char *path, mode_t mode);
/** Helper structure for usage in format_placeholders(). */ /** Helper structure for usage in format_placeholders(). */
typedef struct placeholder_t { typedef struct placeholder_t {
/* The placeholder to be replaced, e.g., "%title". */ /* The placeholder to be replaced, e.g., "%title". */
char *name; const char *name;
/* The value this placeholder should be replaced with. */ /* The value this placeholder should be replaced with. */
char *value; const char *value;
} placeholder_t; } placeholder_t;
/** /**

View File

@ -2318,11 +2318,11 @@ i3String *con_parse_title_format(Con *con) {
char *formatted_str = format_placeholders(con->title_format, &placeholders[0], num); char *formatted_str = format_placeholders(con->title_format, &placeholders[0], num);
i3String *formatted = i3string_from_utf8(formatted_str); i3String *formatted = i3string_from_utf8(formatted_str);
i3string_set_markup(formatted, pango_markup); i3string_set_markup(formatted, pango_markup);
FREE(formatted_str);
for (size_t i = 0; i < num; i++) { free(formatted_str);
FREE(placeholders[i].value); free(title);
} free(class);
free(instance);
return formatted; return formatted;
} }