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 <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
fc23c397c7
commit
fe90355361
6
object.c
6
object.c
|
@ -356,6 +356,12 @@ void object_list_free(struct object_list **list)
|
||||||
*/
|
*/
|
||||||
static char object_array_slopbuf[1];
|
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,
|
void add_object_array_with_path(struct object *obj, const char *name,
|
||||||
struct object_array *array,
|
struct object_array *array,
|
||||||
unsigned mode, const char *path)
|
unsigned mode, const char *path)
|
||||||
|
|
2
object.h
2
object.h
|
@ -57,6 +57,8 @@ struct object_array {
|
||||||
|
|
||||||
#define OBJECT_ARRAY_INIT { 0 }
|
#define OBJECT_ARRAY_INIT { 0 }
|
||||||
|
|
||||||
|
void object_array_init(struct object_array *array);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* object flag allocation:
|
* object flag allocation:
|
||||||
* revision.h: 0---------10 15 23------27
|
* revision.h: 0---------10 15 23------27
|
||||||
|
|
Loading…
Reference in New Issue