From fe90355361430dc52f858845a821370db0c54c80 Mon Sep 17 00:00:00 2001 From: Taylor Blau Date: Mon, 8 May 2023 13:38:06 -0400 Subject: object: add object_array initializer helper function The object_array API has an OBJECT_ARRAY_INIT macro, but lacks a function to initialize an object_array at a given location in memory. Introduce `object_array_init()` to implement such a function. Signed-off-by: Taylor Blau Signed-off-by: Junio C Hamano --- object.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'object.c') diff --git a/object.c b/object.c index 6d4ef1524d..f1adb458b6 100644 --- a/object.c +++ b/object.c @@ -356,6 +356,12 @@ void object_list_free(struct object_list **list) */ static char object_array_slopbuf[1]; +void object_array_init(struct object_array *array) +{ + struct object_array blank = OBJECT_ARRAY_INIT; + memcpy(array, &blank, sizeof(*array)); +} + void add_object_array_with_path(struct object *obj, const char *name, struct object_array *array, unsigned mode, const char *path) -- cgit v1.3-6-g1900