diff options
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 15 |
1 files changed, 11 insertions, 4 deletions
| @@ -211,11 +211,11 @@ d_char *_object_fn(const char *id) | |||
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | 213 | ||
| 214 | int object_get(const char *id, d_char **obj, const char *type) | 214 | int object_get_by_md5(const char *md5, d_char **obj, const char *type) |
| 215 | /* returns a loaded object, optionally of the requested type */ | 215 | /* returns a loaded object, optionally of the requested type */ |
| 216 | { | 216 | { |
| 217 | int status = 404; | 217 | int status = 404; |
| 218 | xs *fn = _object_fn(id); | 218 | xs *fn = _object_fn_by_md5(md5); |
| 219 | FILE *f; | 219 | FILE *f; |
| 220 | 220 | ||
| 221 | if ((f = fopen(fn, "r")) != NULL) { | 221 | if ((f = fopen(fn, "r")) != NULL) { |
| @@ -243,12 +243,19 @@ int object_get(const char *id, d_char **obj, const char *type) | |||
| 243 | else | 243 | else |
| 244 | *obj = NULL; | 244 | *obj = NULL; |
| 245 | 245 | ||
| 246 | srv_debug(2, xs_fmt("object_get %s %d", id, status)); | ||
| 247 | |||
| 248 | return status; | 246 | return status; |
| 249 | } | 247 | } |
| 250 | 248 | ||
| 251 | 249 | ||
| 250 | int object_get(const char *id, d_char **obj, const char *type) | ||
| 251 | /* returns a loaded object, optionally of the requested type */ | ||
| 252 | { | ||
| 253 | xs *md5 = xs_md5_hex(id, strlen(id)); | ||
| 254 | |||
| 255 | return object_get_by_md5(md5, obj, type); | ||
| 256 | } | ||
| 257 | |||
| 258 | |||
| 252 | int object_add(const char *id, d_char *obj) | 259 | int object_add(const char *id, d_char *obj) |
| 253 | /* stores an object */ | 260 | /* stores an object */ |
| 254 | { | 261 | { |