X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fobject.c;h=0a0686540ab36aa3a6cdebfeae6c088e83cf3bf7;hb=89556b90f1afb9b7ebe247c05721e0a04a7232c0;hp=d12461527a4a24889e38cf900b1ecbaf65745e14;hpb=ee29b327c99803abb3426de894601d0655312b13;p=libucw.git diff --git a/lib/object.c b/lib/object.c index d1246152..0a068654 100644 --- a/lib/object.c +++ b/lib/object.c @@ -220,5 +220,41 @@ 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; + *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; }