Thread (138 messages) 138 messages, 11 authors, 2025-01-30
STALE535d

[RFC PATCH 5/6] config: add git_configset_alloc

From: Josh Steadmon <hidden>
Date: 2024-08-07 18:21:45
Subsystem: the rest · Maintainer: Linus Torvalds

Add git_configset_alloc so that non-C external consumers can use
configset functions without redefining config_set.

Co-authored-by: Calvin Wan [off-list ref]
Signed-off-by: Calvin Wan <redacted>
Signed-off-by: Josh Steadmon <redacted>
---
 config.c | 5 +++++
 config.h | 5 +++++
 2 files changed, 10 insertions(+)
diff --git a/config.c b/config.c
index 6421894614..fcfe7fcf46 100644
--- a/config.c
+++ b/config.c
@@ -2324,6 +2324,11 @@ static int config_set_element_cmp(const void *cmp_data UNUSED,
 	return strcmp(e1->key, e2->key);
 }
 
+struct config_set *git_configset_alloc(void)
+{
+	return xmalloc(sizeof(struct config_set));
+}
+
 void git_configset_init(struct config_set *set)
 {
 	hashmap_init(&set->config_hash, config_set_element_cmp, NULL, 0);
diff --git a/config.h b/config.h
index 54b47dec9e..abb4415b80 100644
--- a/config.h
+++ b/config.h
@@ -472,6 +472,11 @@ struct config_set {
 	struct configset_list list;
 };
 
+/**
+ * Alloc a config_set
+ */
+struct config_set *git_configset_alloc(void);
+
 /**
  * Initializes the config_set `cs`.
  */
-- 
2.46.0.rc2.264.g509ed76dc8-goog
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help