]> mj.ucw.cz Git - libucw.git/blobdiff - lib/object.c
WORD_TYPES_HIDDEN shouldn't be considered META by default.
[libucw.git] / lib / object.c
index d12461527a4a24889e38cf900b1ecbaf65745e14..d5e68e74dc0312a4653219f87ac1a2b818e4c0d6 100644 (file)
@@ -60,7 +60,7 @@ obj_free(struct odes *o)
 int
 obj_read(struct fastbuf *f, struct odes *o)
 {
-  byte buf[1024];
+  byte buf[4096];
   struct oattr **last = &o->attrs;
   struct oattr *a, *la;
 
@@ -220,5 +220,43 @@ obj_add_attr(struct odes *o, struct oattr *a, uns x, byte *v)
   b = oa_new(o, x, v);
   a->last_same->same = b;
   a->last_same = b;
+  return a;
+}
+
+struct oattr *
+obj_prepend_attr(struct odes *o, uns x, byte *v)
+{
+  struct oattr *a, *b, **z;
+
+  b = oa_new(o, x, v);
+  z = &o->attrs;
+  while (a = *z)
+    {
+      if (a->attr == x)
+       {
+         b->same = a;
+         b->next = a->next;
+         a->next = NULL;
+         *z = b;
+         b->last_same = a->last_same;
+         return b;
+       }
+      z = &a->next;
+    }
+  b->next = o->attrs;
+  o->attrs = b;
+  return b;
+}
+
+struct oattr *
+obj_insert_attr(struct odes *o, struct oattr *first, struct oattr *after, byte *v)
+{
+  struct oattr *b;
+
+  b = oa_new(o, first->attr, v);
+  b->same = after->same;
+  after->same = b;
+  if (first->last_same == after)
+    first->last_same = b;
   return b;
 }