projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
svn import: fixed two pipe open calls.
[git.git]
/
object.c
diff --git
a/object.c
b/object.c
index
72f6aa5
..
1fdebe0
100644
(file)
--- a/
object.c
+++ b/
object.c
@@
-9,6
+9,8
@@
struct object **objs;
int nr_objs;
static int obj_allocs;
int nr_objs;
static int obj_allocs;
+int track_object_refs = 1;
+
static int find_object(const unsigned char *sha1)
{
int first = 0, last = nr_objs;
static int find_object(const unsigned char *sha1)
{
int first = 0, last = nr_objs;
@@
-67,9
+69,12
@@
void created_object(const unsigned char *sha1, struct object *obj)
void add_ref(struct object *refer, struct object *target)
{
void add_ref(struct object *refer, struct object *target)
{
- struct object_list **pp = &refer->refs;
- struct object_list *p;
-
+ struct object_list **pp, *p;
+
+ if (!track_object_refs)
+ return;
+
+ pp = &refer->refs;
while ((p = *pp) != NULL) {
if (p->item == target)
return;
while ((p = *pp) != NULL) {
if (p->item == target)
return;
@@
-87,6
+92,8
@@
void mark_reachable(struct object *obj, unsigned int mask)
{
struct object_list *p = obj->refs;
{
struct object_list *p = obj->refs;
+ if (!track_object_refs)
+ die("cannot do reachability with object refs turned off");
/* If we've been here already, don't bother */
if (obj->flags & mask)
return;
/* If we've been here already, don't bother */
if (obj->flags & mask)
return;
@@
-184,6
+191,17
@@
struct object_list *object_list_insert(struct object *item,
return new_list;
}
return new_list;
}
+void object_list_append(struct object *item,
+ struct object_list **list_p)
+{
+ while (*list_p) {
+ list_p = &((*list_p)->next);
+ }
+ *list_p = xmalloc(sizeof(struct object_list));
+ (*list_p)->next = NULL;
+ (*list_p)->item = item;
+}
+
unsigned object_list_length(struct object_list *list)
{
unsigned ret = 0;
unsigned object_list_length(struct object_list *list)
{
unsigned ret = 0;