From 6da78a29c4bcd42b93ef0044ec5e005f2ff93e0f Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 5 Sep 2020 13:23:23 +0200 Subject: cleanup: add helper function to set taxonomy category Setting a taxonomy category was cumbersome: the caller had to make sure that the category-table was allocated. Introduce a helper function to make that simpler. Make taxonomy_set_country() the first caller of the new function, since it is just a special case with category = TC_COUNTRY. Signed-off-by: Berthold Stoeger --- core/taxonomy.h | 1 + 1 file changed, 1 insertion(+) (limited to 'core/taxonomy.h') diff --git a/core/taxonomy.h b/core/taxonomy.h index 3af5160be..97205a48f 100644 --- a/core/taxonomy.h +++ b/core/taxonomy.h @@ -44,6 +44,7 @@ void free_taxonomy(struct taxonomy_data *t); void copy_taxonomy(const struct taxonomy_data *orig, struct taxonomy_data *copy); int taxonomy_index_for_category(const struct taxonomy_data *t, enum taxonomy_category cat); const char *taxonomy_get_country(struct taxonomy_data *t); +void taxonomy_set_category(struct taxonomy_data *t, enum taxonomy_category category, const char *value, enum taxonomy_origin origin); void taxonomy_set_country(struct taxonomy_data *t, const char *country, enum taxonomy_origin origin); #ifdef __cplusplus -- cgit v1.2.3-70-g09d2