summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorGravatar default2022-10-03 10:59:08 +0200
committerGravatar default2022-10-03 10:59:08 +0200
commitfc346d1e1f7b782d0a65cd8d147f1e8af162056a (patch)
tree2af73096cbb0cf65512ce100143001bcfaddc1c0 /data.c
parentUse xs_glob() in follower_list(). (diff)
downloadsnac2-fc346d1e1f7b782d0a65cd8d147f1e8af162056a.tar.gz
snac2-fc346d1e1f7b782d0a65cd8d147f1e8af162056a.tar.xz
snac2-fc346d1e1f7b782d0a65cd8d147f1e8af162056a.zip
Use xs_glob() in _timeline_find_fn().
Diffstat (limited to '')
-rw-r--r--data.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/data.c b/data.c
index a0fe787..0753725 100644
--- a/data.c
+++ b/data.c
@@ -296,15 +296,14 @@ d_char *_timeline_find_fn(snac *snac, char *id)
296{ 296{
297 xs *md5 = xs_md5_hex(id, strlen(id)); 297 xs *md5 = xs_md5_hex(id, strlen(id));
298 xs *spec = xs_fmt("%s/timeline/" "*-%s.json", snac->basedir, md5); 298 xs *spec = xs_fmt("%s/timeline/" "*-%s.json", snac->basedir, md5);
299 glob_t globbuf; 299 xs *list = NULL;
300 d_char *fn = NULL; 300 d_char *fn = NULL;
301 301
302 if (glob(spec, 0, NULL, &globbuf) == 0 && globbuf.gl_pathc) { 302 list = xs_glob(spec, 0, 0);
303 /* get just the first file */
304 fn = xs_str_new(globbuf.gl_pathv[0]);
305 }
306 303
307 globfree(&globbuf); 304 /* if there is something, get the first one */
305 if (xs_list_len(list) > 0)
306 fn = xs_str_new(xs_list_get(list, 0));
308 307
309 return fn; 308 return fn;
310} 309}