diff options
| author | 2023-08-19 09:31:13 +0200 | |
|---|---|---|
| committer | 2023-08-19 09:31:13 +0200 | |
| commit | 5de1a9ce0cbdda0ded72a51660130327636eb699 (patch) | |
| tree | 59265f2e9dc5fb8abb43e45a8a23ef3f5dfeaa4e /data.c | |
| parent | Be more strict when serving note objects. (diff) | |
| download | snac2-5de1a9ce0cbdda0ded72a51660130327636eb699.tar.gz snac2-5de1a9ce0cbdda0ded72a51660130327636eb699.tar.xz snac2-5de1a9ce0cbdda0ded72a51660130327636eb699.zip | |
Rewritten history_get() prototype to match static_get().
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 13 |
1 files changed, 9 insertions, 4 deletions
| @@ -1681,18 +1681,23 @@ void history_add(snac *snac, const char *id, const char *content, int size) | |||
| 1681 | } | 1681 | } |
| 1682 | 1682 | ||
| 1683 | 1683 | ||
| 1684 | xs_str *history_get(snac *snac, const char *id) | 1684 | int history_get(snac *snac, const char *id, xs_str **content, int *size, |
| 1685 | const char *inm, xs_str **etag) | ||
| 1685 | { | 1686 | { |
| 1686 | xs_str *content = NULL; | ||
| 1687 | xs *fn = _history_fn(snac, id); | 1687 | xs *fn = _history_fn(snac, id); |
| 1688 | FILE *f; | 1688 | FILE *f; |
| 1689 | int status = 404; | ||
| 1689 | 1690 | ||
| 1690 | if (fn && (f = fopen(fn, "r")) != NULL) { | 1691 | if (fn && (f = fopen(fn, "r")) != NULL) { |
| 1691 | content = xs_readall(f); | 1692 | *content = xs_readall(f); |
| 1692 | fclose(f); | 1693 | fclose(f); |
| 1694 | |||
| 1695 | *size = strlen(*content); | ||
| 1696 | |||
| 1697 | status = 200; | ||
| 1693 | } | 1698 | } |
| 1694 | 1699 | ||
| 1695 | return content; | 1700 | return status; |
| 1696 | } | 1701 | } |
| 1697 | 1702 | ||
| 1698 | 1703 | ||