MCPcopy Index your code
hub / github.com/git/git / add_object_array_with_path

Function add_object_array_with_path

object.c:444–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442}
443
444void add_object_array_with_path(struct object *obj, const char *name,
445 struct object_array *array,
446 unsigned mode, const char *path)
447{
448 unsigned nr = array->nr;
449 unsigned alloc = array->alloc;
450 struct object_array_entry *objects = array->objects;
451 struct object_array_entry *entry;
452
453 if (nr >= alloc) {
454 alloc = (alloc + 32) * 2;
455 REALLOC_ARRAY(objects, alloc);
456 array->alloc = alloc;
457 array->objects = objects;
458 }
459 entry = &objects[nr];
460 entry->item = obj;
461 if (!name)
462 entry->name = NULL;
463 else if (!*name)
464 /* Use our own empty string instead of allocating one: */
465 entry->name = object_array_slopbuf;
466 else
467 entry->name = xstrdup(name);
468 entry->mode = mode;
469 if (path)
470 entry->path = xstrdup(path);
471 else
472 entry->path = NULL;
473 array->nr = ++nr;
474}
475
476void add_object_array(struct object *obj, const char *name, struct object_array *array)
477{

Callers 5

create_bundleFunction · 0.85
add_object_arrayFunction · 0.85
cmd_grepFunction · 0.85

Calls 1

xstrdupFunction · 0.85

Tested by

no test coverage detected