]> mj.ucw.cz Git - libucw.git/commitdiff
Fastbuf: style fixes in fbmulti
authorJan 'Moskyt' Matejka <mq@ucw.cz>
Wed, 11 Jul 2012 14:10:05 +0000 (16:10 +0200)
committerJan 'Moskyt' Matejka <mq@ucw.cz>
Thu, 19 Jul 2012 13:25:28 +0000 (15:25 +0200)
ucw/fb-multi.c

index 5b6b12ba3ce651269c91bd873dcce9d799f3ffd7..89868edc029df542c5c18717d189b9fc5ac9b1ad 100644 (file)
@@ -31,9 +31,8 @@ struct subbuf {
   int allow_close;
   struct fastbuf* fb;
 };
-#define SUBBUF(f) ((struct subbuf *)(f))
 
-static inline void
+static void
 fbmulti_subbuf_get_end(struct subbuf *s)
 {
   if (s->fb->seek) {
@@ -42,7 +41,7 @@ fbmulti_subbuf_get_end(struct subbuf *s)
   }
 }
 
-static inline int
+static int
 fbmulti_subbuf_next(struct fastbuf *f)
 {
   struct subbuf* next = clist_next(FB_MULTI(f)->subbufs, &FB_MULTI(f)->cur->n);
@@ -50,7 +49,7 @@ fbmulti_subbuf_next(struct fastbuf *f)
     return 0;
   
   if (f->seek) {
-    bseek(next->fb, 0, SEEK_SET);
+    bsetpos(next->fb, 0);
     next->begin = FB_MULTI(f)->cur->end;
   }
 
@@ -83,7 +82,7 @@ fbmulti_refill(struct fastbuf *f)
 static void
 fbmulti_get_len(struct fastbuf *f)
 {
-  ASSERT (f->seek);
+  ASSERT(f->seek);
   FB_MULTI(f)->len = 0;
   
   CLIST_FOR_EACH(struct subbuf *, n, *(FB_MULTI(f)->subbufs))
@@ -121,7 +120,7 @@ fbmulti_seek(struct fastbuf *f, ucw_off_t pos, int whence)
 
       } while (1);
 
-      bseek(FB_MULTI(f)->cur->fb, (pos - FB_MULTI(f)->cur->begin), SEEK_SET);
+      bsetpos(FB_MULTI(f)->cur->fb, (pos - FB_MULTI(f)->cur->begin));
       f->pos = pos;
       f->bptr = f->bstop = f->buffer;
       return 1;
@@ -145,8 +144,7 @@ fbmulti_update_capability(struct fastbuf *f) {
   f->seek = fbmulti_seek;
 
   CLIST_FOR_EACH(struct subbuf *, n, *(FB_MULTI(f)->subbufs)) {
-    if (!n->fb->refill)
-      f->refill = NULL;
+    ASSERT(n->fb->refill)
 
     if (!n->fb->seek)
       f->seek = NULL;
@@ -273,7 +271,7 @@ int main(int argc, char ** argv)
          int pos[] = {0, 3, 1, 4, 2, 5};
 
          for (uns i=0;i<ARRAY_SIZE(pos);i++) {
-           bseek(f, pos[i], SEEK_SET);
+           bsetpos(f, pos[i]);
            putchar(bgetc(f));
          }