summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/data.c b/data.c
index 5d4711a..70d48db 100644
--- a/data.c
+++ b/data.c
@@ -211,11 +211,11 @@ d_char *_object_fn(const char *id)
211} 211}
212 212
213 213
214int object_get(const char *id, d_char **obj, const char *type) 214int 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
250int 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
252int object_add(const char *id, d_char *obj) 259int object_add(const char *id, d_char *obj)
253/* stores an object */ 260/* stores an object */
254{ 261{