diff options
-rw-r--r-- | src/til_setup.c | 4 | ||||
-rw-r--r-- | src/til_setup.h | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/til_setup.c b/src/til_setup.c index c1198fd..68728fb 100644 --- a/src/til_setup.c +++ b/src/til_setup.c @@ -3,6 +3,7 @@ #include <stdio.h> #include <stdlib.h> +#include "til_jenkins.h" #include "til_settings.h" #include "til_setup.h" @@ -23,6 +24,7 @@ void * til_setup_new(const til_settings_t *settings, size_t size, void (*free_func)(til_setup_t *setup)) { char *path_buf = NULL; + size_t path_sz; til_setup_t *setup; assert(settings); @@ -30,7 +32,6 @@ void * til_setup_new(const til_settings_t *settings, size_t size, void (*free_fu { /* TODO FIXME: more unportable memstream use! */ FILE *path_fp; - size_t path_sz; int r; path_fp = open_memstream(&path_buf, &path_sz); @@ -52,6 +53,7 @@ void * til_setup_new(const til_settings_t *settings, size_t size, void (*free_fu } setup->path = path_buf; + setup->path_hash = til_jenkins((uint8_t *)path_buf, path_sz); setup->refcount = 1; setup->free = free_func; diff --git a/src/til_setup.h b/src/til_setup.h index 2d0facb..06ed4ea 100644 --- a/src/til_setup.h +++ b/src/til_setup.h @@ -1,11 +1,14 @@ #ifndef _TIL_SETUP_H #define _TIL_SETUP_H +#include <stdint.h> + typedef struct til_settings_t til_settings_t; typedef struct til_setup_t til_setup_t; struct til_setup_t { const char *path; + uint32_t path_hash; unsigned refcount; void (*free)(til_setup_t *setup); }; |