From 115aec7929c19d3276bdf7baa7917f95483cf417 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 24 Jan 2003 18:06:39 +0000 Subject: [PATCH] Object functions are numerous enough to deserve their own header file. --- lib/lib.h | 31 ------------------------------- lib/object.c | 1 + lib/object.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 31 deletions(-) create mode 100644 lib/object.h diff --git a/lib/lib.h b/lib/lib.h index 12e79ec5..abd536d5 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -96,37 +96,6 @@ void *xrealloc(void *, unsigned); void *xmalloc_zero(unsigned); byte *stralloc(byte *); -/* Objects */ - -struct fastbuf; - -struct odes { /* Object description */ - struct oattr *attrs; - struct mempool *pool; - struct oattr *cached_attr; -}; - -struct oattr { /* Object attribute */ - struct oattr *next, *same; - byte attr; - byte val[1]; -}; - -void obj_dump(struct odes *); -struct odes *obj_new(struct mempool *); -int obj_read(struct fastbuf *, struct odes *); -void obj_write(struct fastbuf *, struct odes *); -void obj_write_nocheck(struct fastbuf *, struct odes *); -struct oattr *obj_find_attr(struct odes *, uns); -struct oattr *obj_find_attr_last(struct odes *, uns); -uns obj_del_attr(struct odes *, struct oattr *); -byte *obj_find_aval(struct odes *, uns); -struct oattr *obj_set_attr(struct odes *, uns, byte *); -struct oattr *obj_set_attr_num(struct odes *, uns, uns); -struct oattr *obj_add_attr(struct odes *, uns, byte *); -struct oattr *obj_prepend_attr(struct odes *, uns, byte *); -struct oattr *obj_insert_attr(struct odes *o, struct oattr *first, struct oattr *after, byte *v); - /* Content-Type pattern matching and filters */ int match_ct_patt(byte *, byte *); diff --git a/lib/object.c b/lib/object.c index fb5d231f..0c5f88bd 100644 --- a/lib/object.c +++ b/lib/object.c @@ -10,6 +10,7 @@ #include "lib/lib.h" #include "lib/pools.h" #include "lib/fastbuf.h" +#include "lib/object.h" #include #include diff --git a/lib/object.h b/lib/object.h new file mode 100644 index 00000000..01da6ab9 --- /dev/null +++ b/lib/object.h @@ -0,0 +1,42 @@ +/* + * Sherlock Library -- Object Functions + * + * (c) 1997--2003 Martin Mares + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. + */ + +#ifndef _SHERLOCK_OBJECT_H +#define _SHERLOCK_OBJECT_H + +struct fastbuf; + +struct odes { /* Object description */ + struct oattr *attrs; + struct mempool *pool; + struct oattr *cached_attr; +}; + +struct oattr { /* Object attribute */ + struct oattr *next, *same; + byte attr; + byte val[1]; +}; + +void obj_dump(struct odes *); +struct odes *obj_new(struct mempool *); +int obj_read(struct fastbuf *, struct odes *); +void obj_write(struct fastbuf *, struct odes *); +void obj_write_nocheck(struct fastbuf *, struct odes *); +struct oattr *obj_find_attr(struct odes *, uns); +struct oattr *obj_find_attr_last(struct odes *, uns); +uns obj_del_attr(struct odes *, struct oattr *); +byte *obj_find_aval(struct odes *, uns); +struct oattr *obj_set_attr(struct odes *, uns, byte *); +struct oattr *obj_set_attr_num(struct odes *, uns, uns); +struct oattr *obj_add_attr(struct odes *, uns, byte *); +struct oattr *obj_prepend_attr(struct odes *, uns, byte *); +struct oattr *obj_insert_attr(struct odes *o, struct oattr *first, struct oattr *after, byte *v); + +#endif -- 2.39.5