]> mj.ucw.cz Git - libucw.git/commitdiff
New attributes are now added at the end of the list.
authorMartin Mares <mj@ucw.cz>
Thu, 5 Aug 2004 12:13:41 +0000 (12:13 +0000)
committerMartin Mares <mj@ucw.cz>
Thu, 5 Aug 2004 12:13:41 +0000 (12:13 +0000)
lib/object.c

index 6091d1d75ed20edcfdea7ac8f6b828026263b3bf..ab882c12a139479db0e0f007f41bdb87c0dc6ccb 100644 (file)
@@ -158,14 +158,17 @@ obj_set_attr_num(struct odes *o, uns a, uns v)
 static inline struct oattr *
 obj_add_attr_internal(struct odes *o, struct oattr *b)
 {
-  struct oattr *a;
+  struct oattr *a, **z;
 
   if (!(a = o->cached_attr) || a->attr != b->attr)
     {
-      if (!(a = obj_find_attr(o, b->attr)))
+      z = &o->attrs;
+      while ((a = *z) && a->attr != b->attr)
+       z = &a->next;
+      if (!a)
        {
-         b->next = o->attrs;
-         o->attrs = b;
+         *z = b;
+         /* b->next is NULL */
          goto done;
        }
     }