summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-10-03 10:59:08 +0200
committerdefault <nobody@localhost>2022-10-03 10:59:08 +0200
commitfc346d1e1f7b782d0a65cd8d147f1e8af162056a (patch)
tree2af73096cbb0cf65512ce100143001bcfaddc1c0 /data.c
parent365b27ffb255e5ea9529640b17001e4ad5fcca2d (diff)
Use xs_glob() in _timeline_find_fn().
Diffstat (limited to 'data.c')
-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)
{
xs *md5 = xs_md5_hex(id, strlen(id));
xs *spec = xs_fmt("%s/timeline/" "*-%s.json", snac->basedir, md5);
- glob_t globbuf;
+ xs *list = NULL;
d_char *fn = NULL;
- if (glob(spec, 0, NULL, &globbuf) == 0 && globbuf.gl_pathc) {
- /* get just the first file */
- fn = xs_str_new(globbuf.gl_pathv[0]);
- }
+ list = xs_glob(spec, 0, 0);
- globfree(&globbuf);
+ /* if there is something, get the first one */
+ if (xs_list_len(list) > 0)
+ fn = xs_str_new(xs_list_get(list, 0));
return fn;
}