It frees the whole object.
}
/* clean up everything */
-struct strbuf* strbuf_cleanup(struct strbuf *str) {
+struct strbuf* strbuf_free(struct strbuf *str) {
if (!str)
return NULL;
struct strbuf* strbuf_new(void);
ssize_t strbuf_add_string(struct strbuf *str, const char *s, size_t len);
void strbuf_complete(struct strbuf *str);
-struct strbuf* strbuf_cleanup(struct strbuf *str);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct strbuf*, strbuf_cleanup);
+struct strbuf* strbuf_free(struct strbuf *str);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct strbuf*, strbuf_free);
return NULL;
trie_node_cleanup(trie->root);
- strbuf_cleanup(trie->strings);
+ strbuf_free(trie->strings);
return mfree(trie);
}
int catalog_update(const char* database, const char* root, const char* const* dirs) {
_cleanup_strv_free_ char **files = NULL;
char **f;
- _cleanup_(strbuf_cleanupp) struct strbuf *sb = NULL;
+ _cleanup_(strbuf_freep) struct strbuf *sb = NULL;
_cleanup_ordered_hashmap_free_free_free_ OrderedHashmap *h = NULL;
_cleanup_free_ CatalogItem *items = NULL;
ssize_t offset;
}
static void test_strbuf(void) {
- _cleanup_(strbuf_cleanupp) struct strbuf *sb;
+ _cleanup_(strbuf_freep) struct strbuf *sb;
_cleanup_strv_free_ char **l;
ssize_t a, b, c, d, e, f, g, h;