Commit 229ff0ad authored by Sebastian Ramacher's avatar Sebastian Ramacher

Remove some extra allocations

Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 2695a53b
......@@ -195,9 +195,7 @@ zathura_get_version_string(zathura_t* zathura, bool markup)
GString* string = g_string_new(NULL);
/* zathura version */
char* zathura_version = g_strdup_printf("zathura %d.%d.%d", ZATHURA_VERSION_MAJOR, ZATHURA_VERSION_MINOR, ZATHURA_VERSION_REV);
g_string_append(string, zathura_version);
g_free(zathura_version);
g_string_append_printf(string, "zathura %d.%d.%d", ZATHURA_VERSION_MAJOR, ZATHURA_VERSION_MINOR, ZATHURA_VERSION_REV);
const char* format = (markup == true) ? "\n<i>(plugin)</i> %s (%d.%d.%d) <i>(%s)</i>" : "\n(plugin) %s (%d.%d.%d) (%s)";
......@@ -207,15 +205,12 @@ zathura_get_version_string(zathura_t* zathura, bool markup)
GIRARA_LIST_FOREACH(plugins, zathura_plugin_t*, iter, plugin) {
char* name = zathura_plugin_get_name(plugin);
zathura_plugin_version_t version = zathura_plugin_get_version(plugin);
char* text = g_strdup_printf(format,
(name == NULL) ? "-" : name,
version.major,
version.minor,
version.rev,
zathura_plugin_get_path(plugin)
);
g_string_append(string, text);
g_free(text);
g_string_append_printf(string, format,
(name == NULL) ? "-" : name,
version.major,
version.minor,
version.rev,
zathura_plugin_get_path(plugin));
} GIRARA_LIST_FOREACH_END(plugins, zathura_plugin_t*, iter, plugin);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment