renamed fct
authorJean-Philippe Orsini <jeanfi@gmail.com>
Tue, 6 Sep 2011 21:56:42 +0000 (21:56 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Tue, 6 Sep 2011 21:56:42 +0000 (21:56 +0000)
src/html.c

index 10dc668..7f8a8d3 100644 (file)
@@ -209,11 +209,12 @@ fcopy(const char *src, const char *dst)
        return ret;
 }
 
-static char *get_path(const char *dir, const char *file)
+static char *path_new(const char *dir, const char *file, const char *suffixe)
 {
        char *path = malloc(strlen(dir)+1+
                            strlen(file)+
                            strlen(".html")+
+                           (suffixe ? strlen(suffixe) : 0) +
                            1);
 
        strcpy(path, dir);
@@ -443,7 +444,7 @@ pkg_to_html(struct ppa_stats *ppa, struct package_stats *pkg, const char *dir)
        FILE *f;
        char *json;
 
-       path = get_path(dir, pkg->name);
+       path = path_new(dir, pkg->name, ".html");
        f = fopen(path, "w");
 
        if (!f) {
@@ -473,7 +474,7 @@ version_to_html(struct ppa_stats *ppa,
        f_name = malloc(strlen(pkg->name)+1+strlen(version->version)+1);
        sprintf(f_name, "%s_%s", pkg->name, version->version);
 
-       path = get_path(dir, f_name);
+       path = path_new(dir, f_name, ".html");
        f = fopen(path, "w");
 
        if (!f) {
@@ -520,7 +521,7 @@ index_to_html(struct ppa_stats *ppa, const char *dir)
        char *path;
        FILE *f;
 
-       path = get_path(dir, "index");
+       path = path_new(dir, "index", ".html");
        f = fopen(path, "w");
 
        if (!f) {
@@ -589,7 +590,7 @@ ppa_to_html(const char *owner,
        ppastats = create_ppa_stats(owner, ppa, package_status);
        totals = ppastats->daily_download_totals;
 
-       path = get_path(output_dir, "ppa");
+       path = path_new(output_dir, "ppa", ".html");
 
        packages_to_html(ppastats, ppastats->packages, output_dir);