]> mj.ucw.cz Git - libucw.git/blobdiff - lib/object.c
indexer rewritten to generate redirect brackets
[libucw.git] / lib / object.c
index 6f047863086bd508c4c8242d10895fd3c86a1d3b..fb957bd7e61169271226a5689738e30f8a7fc8ae 100644 (file)
@@ -244,3 +244,43 @@ obj_insert_attr(struct odes *o, struct oattr *first, struct oattr *after, byte *
   after->same = b;
   return b;
 }
+
+void
+obj_move_attr_to_head(struct odes *o, uns x)
+{
+  struct oattr *a, **z;
+
+  z = &o->attrs;
+  while (a = *z)
+    {
+      if (a->attr == x)
+       {
+         *z = a->next;
+         a->next = o->attrs;
+         o->attrs = a;
+         break;
+       }
+      z = &a->next;
+    }
+}
+
+void
+obj_move_attr_to_tail(struct odes *o, uns x)
+{
+  struct oattr *a, **z;
+
+  z = &o->attrs;
+  while (a = *z)
+    {
+      if (a->attr == x)
+       {
+         *z = a->next;
+         while (*z)
+           z = &(*z)->next;
+         *z = a;
+         a->next = NULL;
+         break;
+       }
+      z = &a->next;
+    }
+}