X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Ffcache.c;h=1c9fe6655194402135bd443eb13cd8e365ae9b8c;hb=34927360bfa85566cc40a5fface548a98f476288;hp=1a4623c3b52948c4d059037e42b21df233f9f7e5;hpb=5969698ff6028947e097927e2391406481a36290;p=ppastats.git diff --git a/src/fcache.c b/src/fcache.c index 1a4623c..1c9fe66 100644 --- a/src/fcache.c +++ b/src/fcache.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2012 jeanfi@gmail.com + * Copyright (C) 2011-2014 jeanfi@gmail.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -26,8 +26,8 @@ #include #include "fcache.h" -#include "io.h" -#include "log.h" +#include +#include static const char *cache_dir; @@ -67,7 +67,7 @@ static char *key_to_path(const char *key) return NULL; path = malloc(strlen(dir) + 1 + strlen(key) + strlen("/data") + 1); - sprintf(path, "%s%s/data", dir, key); + sprintf(path, "%s%s.data", dir, key); return path; } @@ -83,18 +83,18 @@ char *fcache_get(const char *key) } content = file_get_content(path); - + if (content) log_debug(_("file cache hit %s"), key); else log_debug(_("file cache miss %s %s"), key, path); - + free(path); - + return content; } - -void fcache_put(const char *key, char *value) + +void fcache_put(const char *key, const char *value) { char *path, *dir, *tmp; FILE *f;