Simplify building of stylefiles path

We can directly use style file pointers instead of using temporary
string pointers.
This commit is contained in:
Quentin Rameau 2015-11-20 00:17:50 +01:00
parent ba8617e4ee
commit 2c2a7b608e

13
surf.c
View File

@ -1263,7 +1263,6 @@ void
setup(void) setup(void)
{ {
int i; int i;
char *styledirfile, *stylepath;
WebKitWebContext *context; WebKitWebContext *context;
GError *error = NULL; GError *error = NULL;
@ -1282,6 +1281,7 @@ setup(void)
cookiefile = buildfile(cookiefile); cookiefile = buildfile(cookiefile);
scriptfile = buildfile(scriptfile); scriptfile = buildfile(scriptfile);
cachedir = buildpath(cachedir); cachedir = buildpath(cachedir);
if (stylefile == NULL) { if (stylefile == NULL) {
styledir = buildpath(styledir); styledir = buildpath(styledir);
for (i = 0; i < LENGTH(styles); i++) { for (i = 0; i < LENGTH(styles); i++) {
@ -1292,19 +1292,12 @@ setup(void)
styles[i].regex); styles[i].regex);
styles[i].regex = NULL; styles[i].regex = NULL;
} }
styledirfile = g_strconcat(styledir, "/", styles[i].style = g_strconcat(styledir, "/",
styles[i].style, NULL); styles[i].style, NULL);
stylepath = buildfile(styledirfile);
styles[i].style = g_strconcat("file://", stylepath,
NULL);
g_free(styledirfile);
g_free(stylepath);
} }
g_free(styledir); g_free(styledir);
} else { } else {
stylepath = buildfile(stylefile); stylefile = buildfile(stylefile);
stylefile = g_strconcat("file://", stylepath, NULL);
g_free(stylepath);
} }
} }