[Tarantool-patches] [PATCH luajit v2 2/7] core: introduce write buffer module

Sergey Kaplun skaplun at tarantool.org
Mon Dec 28 04:43:26 MSK 2020


Fixed warning "pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]"
Changed naming.

See iterative patch below. Branch will be force-pushed later with
v3 series.
===================================================================
diff --git a/src/lj_wbuf.c b/src/lj_wbuf.c
index ef46545..897ef08 100644
--- a/src/lj_wbuf.c
+++ b/src/lj_wbuf.c
@@ -90,7 +90,7 @@ void lj_wbuf_addn(struct lj_wbuf *buf, const void *src, size_t n)
     memcpy(buf->pos, src, left);
     buf->pos += (ptrdiff_t)left;
     lj_wbuf_flush(buf);
-    src += (ptrdiff_t)left;
+    src = (uint8_t *)src + (ptrdiff_t)left;
     n -= left;
   }
 
@@ -120,7 +120,7 @@ void LJ_FASTCALL lj_wbuf_flush(struct lj_wbuf *buf)
   written = buf->writer((const void **)&buf->buf, len, buf->ctx);
 
   if (LJ_UNLIKELY(written < len)) {
-    wbuf_set_flag(buf, STREAM_ERR_IO);
+    wbuf_set_flag(buf, STREAM_ERRIO);
     wbuf_save_errno(buf);
   }
   if (LJ_UNLIKELY(buf->buf == NULL)) {
diff --git a/src/lj_wbuf.h b/src/lj_wbuf.h
index 77a7cf4..9eaa5e5 100644
--- a/src/lj_wbuf.h
+++ b/src/lj_wbuf.h
@@ -28,7 +28,7 @@
 */
 
 /* Stream errors. */
-#define STREAM_ERR_IO 0x1
+#define STREAM_ERRIO 0x1
 #define STREAM_STOP   0x2
 
 /*
===================================================================

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list