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 *
|
EAPI char *
|
||||||
extra_theme_download_url_get(Extra_Theme *theme)
|
extra_theme_download_url_get(Extra_Theme *theme)
|
||||||
{
|
{
|
||||||
const char *pattern = "http://" HOSTNAME "/themes/%s-%d.edj";
|
Eina_Strbuf *buf;
|
||||||
char *url;
|
char *url;
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(theme, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(theme, NULL);
|
||||||
|
|
||||||
url = malloc((strlen(pattern) + strlen(theme->id) - 1 + (int)(log10(theme->version))) * sizeof(char));
|
buf = eina_strbuf_new();
|
||||||
sprintf(url, pattern, theme->id, theme->version);
|
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;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue