@matheusbsbs / matheus-bagliano / commits / e5709a4a68
Fork 0

add add_object_array_with_mode

Each object in struct object_array is extended with the mode. If not specified, S_IFINVALID is used. An object with an mode value can be added with add_object_array_with_mode. Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <junkio@cox.net>

Martin Koegler committed Apr 22, 2007 at 18:43 UTC e5709a4a6809e45bf59b851debf24a813e1c6b58
2 files changed +8
object.c
+6
@@ -230,6 +230,11 @@ int object_list_contains(struct object_list *list, struct object *obj)
230 }
231
232 void add_object_array(struct object *obj, const char *name, struct object_array *array)
233 +{
234 + add_object_array_with_mode(obj, name, array, S_IFINVALID);
235 +}
236 +
237 +void add_object_array_with_mode(struct object *obj, const char *name, struct object_array *array, unsigned mode)
238 {
239 unsigned nr = array->nr;
240 unsigned alloc = array->alloc;
@@ -243,5 +248,6 @@ void add_object_array(struct object *obj, const char *name, struct object_array
248 }
249 objects[nr].item = obj;
250 objects[nr].name = name;
251 + objects[nr].mode = mode;
252 array->nr = ++nr;
253 }
object.h
+2
@@ -17,6 +17,7 @@ struct object_array {
17 struct object_array_entry {
18 struct object *item;
19 const char *name;
20 + unsigned mode;
21 } *objects;
22 };
23
@@ -77,5 +78,6 @@ int object_list_contains(struct object_list *list, struct object *obj);
78
79 /* Object array handling .. */
80 void add_object_array(struct object *obj, const char *name, struct object_array *array);
81 +void add_object_array_with_mode(struct object *obj, const char *name, struct object_array *array, unsigned mode);
82
83 #endif /* OBJECT_H */