extra: use strbuf
the other calculation was a bit rough to read. And strbuf handles that better.
This commit is contained in:
parent
8c786787de
commit
b04e0fcd5d
|
@ -445,13 +445,17 @@ extra_theme_preview_download(Extra_Progress *progress, Extra_Theme *theme)
|
|||
EAPI char *
|
||||
extra_theme_download_url_get(Extra_Theme *theme)
|
||||
{
|
||||
const char *pattern = "http://" HOSTNAME "/themes/%s-%d.edj";
|
||||
Eina_Strbuf *buf;
|
||||
char *url;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(theme, NULL);
|
||||
|
||||
url = malloc((strlen(pattern) + strlen(theme->id) - 1 + (int)(log10(theme->version))) * sizeof(char));
|
||||
sprintf(url, pattern, theme->id, theme->version);
|
||||
buf = eina_strbuf_new();
|
||||
eina_strbuf_append(buf, "http://" HOSTNAME "/themes/");
|
||||
eina_strbuf_append_printf(buf, "%s-%d.edj", theme->id, theme->version);
|
||||
|
||||
url = eina_strbuf_string_steal(buf);
|
||||
eina_strbuf_free(url);
|
||||
|
||||
return url;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue