tSimplify building of stylefiles path - surf - customized build of surf, the suckless webkit browser
 (HTM) git clone git://src.adamsgaard.dk/surf
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 2c2a7b608e01d2347812a84ecb08f98cb4d13789
 (DIR) parent ba8617e4ee9ff35a45059930ef611cb85ed33af2
 (HTM) Author: Quentin Rameau <quinq@fifth.space>
       Date:   Fri, 20 Nov 2015 00:17:50 +0100
       
       Simplify building of stylefiles path
       
       We can directly use style file pointers instead of using temporary
       string pointers.
       
       Diffstat:
         M surf.c                              |      15 ++++-----------
       
       1 file changed, 4 insertions(+), 11 deletions(-)
       ---
 (DIR) diff --git a/surf.c b/surf.c
       t@@ -1263,7 +1263,6 @@ void
        setup(void)
        {
                int i;
       -        char *styledirfile, *stylepath;
                WebKitWebContext *context;
                GError *error = NULL;
        
       t@@ -1282,6 +1281,7 @@ setup(void)
                cookiefile = buildfile(cookiefile);
                scriptfile = buildfile(scriptfile);
                cachedir   = buildpath(cachedir);
       +
                if (stylefile == NULL) {
                        styledir = buildpath(styledir);
                        for (i = 0; i < LENGTH(styles); i++) {
       t@@ -1292,19 +1292,12 @@ setup(void)
                                                styles[i].regex);
                                        styles[i].regex = NULL;
                                }
       -                        styledirfile    = g_strconcat(styledir, "/",
       -                                                      styles[i].style, NULL);
       -                        stylepath       = buildfile(styledirfile);
       -                        styles[i].style = g_strconcat("file://", stylepath,
       -                                                      NULL);
       -                        g_free(styledirfile);
       -                        g_free(stylepath);
       +                        styles[i].style = g_strconcat(styledir, "/",
       +                            styles[i].style, NULL);
                        }
                        g_free(styledir);
                } else {
       -                stylepath = buildfile(stylefile);
       -                stylefile = g_strconcat("file://", stylepath, NULL);
       -                g_free(stylepath);
       +                stylefile = buildfile(stylefile);
                }
        }