]> mj.ucw.cz Git - libucw.git/commitdiff
Moved object reading and writing functions where they belong.
authorMartin Mares <mj@ucw.cz>
Sat, 10 Jul 2004 20:46:55 +0000 (20:46 +0000)
committerMartin Mares <mj@ucw.cz>
Sat, 10 Jul 2004 20:46:55 +0000 (20:46 +0000)
lib/buck2obj.c
lib/obj2buck.c
lib/object.c
lib/object.h

index 52be40d82e1df021e7a2cd0f0bb42bb15eb8ff6f..7d651dfe6b65f6941f375a4c32ef53f88033c06d 100644 (file)
@@ -163,3 +163,27 @@ obj_read_bucket(struct buck2obj_buf *buf, struct mempool *pool, uns buck_type, u
   else
     return o;
 }
+
+int
+obj_read(struct fastbuf *f, struct odes *o)
+{
+  byte buf[MAX_ATTR_SIZE];
+
+  while (bgets(f, buf, sizeof(buf)))
+    {
+      if (!buf[0])
+       return 1;
+      obj_add_attr(o, buf[0], buf+1);
+    }
+  return 0;
+}
+
+void
+obj_read_multi(struct fastbuf *f, struct odes *o)
+{
+  /* Read a multi-part object ending with either EOF or a NUL character */
+  byte buf[MAX_ATTR_SIZE];
+  while (bpeekc(f) > 0 && bgets(f, buf, sizeof(buf)))
+    if (buf[0])
+      obj_add_attr(o, buf[0], buf+1);
+}
index 9198fad56ec4c449243c21da264a044533b50a81..0ced895bea00c8132bc19ddfdb3a41c6a03b7eb3 100644 (file)
@@ -184,3 +184,29 @@ bput_attr_num(struct fastbuf *b, uns type, uns val)
   else
     bprintf(b, "%c%d\n", type, val);
 }
+
+void
+obj_write(struct fastbuf *f, struct odes *d)
+{
+  for(struct oattr *a=d->attrs; a; a=a->next)
+    for(struct oattr *b=a; b; b=b->same)
+      {
+       byte *z;
+       for (z = b->val; *z; z++)
+         if (*z < ' ' && *z != '\t')
+           {
+             log(L_ERROR, "obj_dump: Found non-ASCII characters (URL might be %s)", obj_find_aval(d, 'U'));
+             *z = '?';
+           }
+       ASSERT(z - b->val <= MAX_ATTR_SIZE-2);
+       bput_attr_str(f, a->attr, b->val);
+      }
+}
+
+void
+obj_write_nocheck(struct fastbuf *f, struct odes *d)
+{
+  for(struct oattr *a=d->attrs; a; a=a->next)
+    for(struct oattr *b=a; b; b=b->same)
+      bput_attr_str(f, a->attr, b->val);
+}
index 32beab2e895e0474825fba895afeeae97f5dc52c..22d906473138033c163f23b0665b79bb207716ed 100644 (file)
@@ -57,56 +57,6 @@ obj_new(struct mempool *pool)
   return o;
 }
 
-int
-obj_read(struct fastbuf *f, struct odes *o)
-{
-  byte buf[MAX_ATTR_SIZE];
-
-  while (bgets(f, buf, sizeof(buf)))
-    {
-      if (!buf[0])
-       return 1;
-      obj_add_attr(o, buf[0], buf+1);
-    }
-  return 0;
-}
-
-void
-obj_read_multi(struct fastbuf *f, struct odes *o)
-{
-  /* Read a multi-part object ending with either EOF or a NUL character */
-  byte buf[MAX_ATTR_SIZE];
-  while (bpeekc(f) > 0 && bgets(f, buf, sizeof(buf)))
-    if (buf[0])
-      obj_add_attr(o, buf[0], buf+1);
-}
-
-void
-obj_write(struct fastbuf *f, struct odes *d)
-{
-  for(struct oattr *a=d->attrs; a; a=a->next)
-    for(struct oattr *b=a; b; b=b->same)
-      {
-       byte *z;
-       for (z = b->val; *z; z++)
-         if (*z < ' ' && *z != '\t')
-           {
-             log(L_ERROR, "obj_dump: Found non-ASCII characters (URL might be %s)", obj_find_aval(d, 'U'));
-             *z = '?';
-           }
-       ASSERT(z - b->val <= MAX_ATTR_SIZE-2);
-       bput_attr_str(f, a->attr, b->val);
-      }
-}
-
-void
-obj_write_nocheck(struct fastbuf *f, struct odes *d)
-{
-  for(struct oattr *a=d->attrs; a; a=a->next)
-    for(struct oattr *b=a; b; b=b->same)
-      bput_attr_str(f, a->attr, b->val);
-}
-
 struct oattr *
 obj_find_attr(struct odes *o, uns x)
 {
index 7ec9965855bb571542d2fb2ce6c1681bba21921b..9b79f482e18ba48d2c02804fb0b955c5efb999f2 100644 (file)
@@ -30,10 +30,6 @@ struct oattr {                               /* Object attribute */
 
 void obj_dump(struct odes *);
 struct odes *obj_new(struct mempool *);
-int obj_read(struct fastbuf *, struct odes *);
-void obj_read_multi(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 *);
@@ -63,6 +59,9 @@ struct odes *obj_read_bucket(struct buck2obj_buf *buf, struct mempool *pool, uns
    * However, no such things are performed when reading the header only.
    */
 
+int obj_read(struct fastbuf *, struct odes *);
+void obj_read_multi(struct fastbuf *, struct odes *);
+
 /* obj2buck.c: Generating buckets from objects */
 
 void attr_set_type(uns type);
@@ -79,4 +78,7 @@ void bput_attr_vformat(struct fastbuf *b, uns type, byte *mask, va_list va);
 void bput_attr_format(struct fastbuf *b, uns type, char *mask, ...) __attribute__((format(printf,3,4)));
 void bput_attr_num(struct fastbuf *b, uns type, uns val);
 
+void obj_write(struct fastbuf *, struct odes *);
+void obj_write_nocheck(struct fastbuf *, struct odes *);
+
 #endif