*/
#include "lib/lib.h"
-#include "lib/pools.h"
+#include "lib/mempool.h"
#include "lib/fastbuf.h"
#include "lib/object.h"
#include <string.h>
#include <stdio.h>
+#include <stdlib.h>
void
obj_dump(struct odes *o)
return a ? a->val : NULL;
}
+uns
+obj_find_anum(struct odes *o, uns x, uns def)
+{
+ struct oattr *a = obj_find_attr(o, x);
+ return a ? (uns)atol(a->val) : def;
+}
+
struct oattr *
obj_set_attr(struct odes *o, uns x, byte *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;
}
}