]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/fb-socket.c
ABI: Symbol renames for libucw and libcharset
[libucw.git] / ucw / fb-socket.c
index d90f7e7c18bbedfe1bfa24c00ec7091a2deab18e..0a78273f3ec124f0d1d885d8ede0d46ec33e61e5 100644 (file)
@@ -7,9 +7,9 @@
  *     of the GNU Lesser General Public License.
  */
 
-#include "ucw/lib.h"
-#include "ucw/fastbuf.h"
-#include "ucw/fb-socket.h"
+#include <ucw/lib.h>
+#include <ucw/fastbuf.h>
+#include <ucw/fb-socket.h>
 
 #include <stdio.h>
 #include <unistd.h>
@@ -22,7 +22,7 @@ struct fb_sock {
   byte buf[0];
 };
 
-#define FB_SOCK(f) ((struct fb_sock *)(f)->is_fastbuf)
+#define FB_SOCK(f) ((struct fb_sock *)(f))
 
 static int
 fbs_refill(struct fastbuf *f)
@@ -71,9 +71,9 @@ fbs_spout(struct fastbuf *f)
       .events = POLLOUT,
   };
 
-  int l = f->bptr - f->buffer;
-  f->bptr = f->buffer;
-  char *buf = f->buffer;
+  int l = f->bptr - f->bstop;
+  f->bptr = f->bstop;
+  char *buf = f->bstop;
 
   while (l)
     {
@@ -105,7 +105,8 @@ fbs_spout(struct fastbuf *f)
 static void
 fbs_close(struct fastbuf *f)
 {
-  close(FB_SOCK(f)->par.fd);
+  if (!FB_SOCK(f)->par.fd_is_shared)
+    close(FB_SOCK(f)->par.fd);
   xfree(f);
 }
 
@@ -125,7 +126,6 @@ fbsock_create(struct fbsock_params *p)
   f->spout = fbs_spout;
   f->close = fbs_close;
   f->can_overwrite_buffer = 1;
-  fb_tie(f);
   return f;
 }