From 1615d219c1860f6a5a45ecb9b82fa60a9316748c Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja@tarantool.org>
Date: Mon, 8 Oct 2012 16:42:41 +0400
Subject: [PATCH] Make it possible to pass variadic arguments to fiber_call.

Change a single void * pointer passed to fiber_create
to a variadic list passed to every fiber_call().
---
 include/fiber.h              |  10 +-
 include/iproto.h             |   2 +-
 mod/box/box.m                |   4 +-
 mod/box/memcached-grammar.m  | 459 +++++++++++++++++------------------
 mod/box/memcached-grammar.rl |   9 +-
 mod/box/memcached.h          |   2 +-
 mod/box/memcached.m          |  10 +-
 src/admin.m                  |   2 +-
 src/admin.rl                 |   2 +-
 src/fiber.m                  |  25 +-
 src/iproto.m                 |   3 +-
 src/replica.m                |   8 +-
 src/tarantool_lua.m          |  12 +-
 13 files changed, 270 insertions(+), 278 deletions(-)

diff --git a/include/fiber.h b/include/fiber.h
index f047d0151b..a048249266 100644
--- a/include/fiber.h
+++ b/include/fiber.h
@@ -87,8 +87,8 @@ struct fiber {
 
 	/* ASCIIZ name of this fiber. */
 	char name[FIBER_NAME_MAXLEN];
-	void (*f) (void *);
-	void *f_data;
+	void (*f) (va_list);
+	va_list f_data;
 	u64 cookie;
 	bool has_peer;
 	/* ASCIIZ name of the peer, if there is one. */
@@ -111,7 +111,7 @@ extern __thread struct fiber *fiber;
 
 void fiber_init(void);
 void fiber_free(void);
-struct fiber *fiber_create(const char *name, int fd, void (*f) (void *), void *);
+struct fiber *fiber_create(const char *name, int fd, void (*f) (va_list));
 void fiber_set_name(struct fiber *fiber, const char *name);
 void wait_for_child(pid_t pid);
 
@@ -175,7 +175,7 @@ ssize_t fiber_write(const void *buf, size_t count);
 int fiber_close(void);
 void fiber_cleanup(void);
 void fiber_gc(void);
-void fiber_call(struct fiber *callee);
+void fiber_call(struct fiber *callee, ...);
 void fiber_wakeup(struct fiber *f);
 struct fiber *fiber_find(int fid);
 /** Cancel a fiber. A cancelled fiber will have
@@ -198,7 +198,7 @@ void fiber_sleep(ev_tstamp s);
 void fiber_info(struct tbuf *out);
 int set_nonblock(int sock);
 
-typedef void (*fiber_server_callback)(void *);
+typedef void (*fiber_server_callback)(va_list);
 
 struct fiber *fiber_server(const char *name, int port,
 			   fiber_server_callback callback, void *,
diff --git a/include/iproto.h b/include/iproto.h
index 165899c86d..e36b463bef 100644
--- a/include/iproto.h
+++ b/include/iproto.h
@@ -64,6 +64,6 @@ static inline struct iproto_header *iproto(const struct tbuf *t)
 
 typedef void (*iproto_callback) (uint32_t msg_code, struct tbuf *request);
 
-void iproto_interact(iproto_callback callback);
+void iproto_interact(va_list ap);
 
 #endif
diff --git a/mod/box/box.m b/mod/box/box.m
index 55bd73856e..b433a9c5ca 100644
--- a/mod/box/box.m
+++ b/mod/box/box.m
@@ -520,14 +520,14 @@ mod_init(void)
 	/* run primary server */
 	if (cfg.primary_port != 0)
 		fiber_server("primary", cfg.primary_port,
-			     (fiber_server_callback) iproto_interact,
+			     iproto_interact,
 			     iproto_primary_port_handler,
 			     box_leave_local_standby_mode);
 
 	/* run secondary server */
 	if (cfg.secondary_port != 0)
 		fiber_server("secondary", cfg.secondary_port,
-			     (fiber_server_callback) iproto_interact,
+			     iproto_interact,
 			     iproto_secondary_port_handler, NULL);
 
 	/* run memcached server */
diff --git a/mod/box/memcached-grammar.m b/mod/box/memcached-grammar.m
index cab9b1e4f0..d840bd75b9 100644
--- a/mod/box/memcached-grammar.m
+++ b/mod/box/memcached-grammar.m
@@ -144,7 +144,7 @@ case 5:
 		goto st0;
 	goto tr15;
 tr15:
-#line 225 "mod/box/memcached-grammar.rl"
+#line 222 "mod/box/memcached-grammar.rl"
 	{
 			fstart = p;
 			for (; p < pe && *p != ' ' && *p != '\r' && *p != '\n'; p++);
@@ -175,7 +175,7 @@ case 7:
 		goto tr17;
 	goto st0;
 tr17:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st8;
 st8:
@@ -189,7 +189,7 @@ case 8:
 		goto st8;
 	goto st0;
 tr18:
-#line 248 "mod/box/memcached-grammar.rl"
+#line 245 "mod/box/memcached-grammar.rl"
 	{flags = natoq(fstart, p);}
 	goto st9;
 st9:
@@ -203,7 +203,7 @@ case 9:
 		goto tr21;
 	goto st0;
 tr21:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st10;
 st10:
@@ -217,7 +217,7 @@ case 10:
 		goto st10;
 	goto st0;
 tr22:
-#line 241 "mod/box/memcached-grammar.rl"
+#line 238 "mod/box/memcached-grammar.rl"
 	{
 			exptime = natoq(fstart, p);
 			if (exptime > 0 && exptime <= 60*60*24*30)
@@ -235,7 +235,7 @@ case 11:
 		goto tr25;
 	goto st0;
 tr25:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st12;
 st12:
@@ -252,11 +252,11 @@ case 12:
 		goto st12;
 	goto st0;
 tr26:
-#line 249 "mod/box/memcached-grammar.rl"
+#line 246 "mod/box/memcached-grammar.rl"
 	{bytes = natoq(fstart, p);}
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -277,7 +277,7 @@ tr26:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -294,9 +294,9 @@ tr26:
 		}
 	goto st197;
 tr30:
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -317,7 +317,7 @@ tr30:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -334,11 +334,11 @@ tr30:
 		}
 	goto st197;
 tr39:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -359,7 +359,7 @@ tr39:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -376,11 +376,11 @@ tr39:
 		}
 	goto st197;
 tr58:
-#line 249 "mod/box/memcached-grammar.rl"
+#line 246 "mod/box/memcached-grammar.rl"
 	{bytes = natoq(fstart, p);}
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -401,7 +401,7 @@ tr58:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -436,9 +436,9 @@ tr58:
 		}
 	goto st197;
 tr62:
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -459,7 +459,7 @@ tr62:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -494,11 +494,11 @@ tr62:
 		}
 	goto st197;
 tr71:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -519,7 +519,7 @@ tr71:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -554,11 +554,11 @@ tr71:
 		}
 	goto st197;
 tr91:
-#line 250 "mod/box/memcached-grammar.rl"
+#line 247 "mod/box/memcached-grammar.rl"
 	{cas = natoq(fstart, p);}
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -579,7 +579,7 @@ tr91:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -598,9 +598,9 @@ tr91:
 		}
 	goto st197;
 tr95:
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -621,7 +621,7 @@ tr95:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -640,11 +640,11 @@ tr95:
 		}
 	goto st197;
 tr105:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -665,7 +665,7 @@ tr105:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -684,11 +684,11 @@ tr105:
 		}
 	goto st197;
 tr118:
-#line 251 "mod/box/memcached-grammar.rl"
+#line 248 "mod/box/memcached-grammar.rl"
 	{incr = natoq(fstart, p);}
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -751,9 +751,9 @@ tr118:
 		}
 	goto st197;
 tr122:
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -816,11 +816,11 @@ tr122:
 		}
 	goto st197;
 tr132:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -883,9 +883,9 @@ tr132:
 		}
 	goto st197;
 tr141:
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -911,15 +911,15 @@ tr141:
 		}
 	goto st197;
 tr146:
-#line 241 "mod/box/memcached-grammar.rl"
+#line 238 "mod/box/memcached-grammar.rl"
 	{
 			exptime = natoq(fstart, p);
 			if (exptime > 0 && exptime <= 60*60*24*30)
 				exptime = exptime + ev_now();
 		}
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -945,11 +945,11 @@ tr146:
 		}
 	goto st197;
 tr157:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -975,9 +975,9 @@ tr157:
 		}
 	goto st197;
 tr169:
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -985,21 +985,18 @@ tr169:
 		}
 #line 206 "mod/box/memcached-grammar.rl"
 	{
-			if (flush_delay > 0) {
-				struct fiber *f = fiber_create("flush_all", -1, flush_all, (void *)flush_delay);
-				if (f)
-					fiber_call(f);
-			} else
-				flush_all((void *)0);
+			struct fiber *f = fiber_create("flush_all", -1, flush_all);
+			if (f)
+				fiber_call(f, flush_delay);
 			iov_add("OK\r\n", 4);
 		}
 	goto st197;
 tr174:
-#line 252 "mod/box/memcached-grammar.rl"
+#line 249 "mod/box/memcached-grammar.rl"
 	{flush_delay = natoq(fstart, p);}
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -1007,21 +1004,18 @@ tr174:
 		}
 #line 206 "mod/box/memcached-grammar.rl"
 	{
-			if (flush_delay > 0) {
-				struct fiber *f = fiber_create("flush_all", -1, flush_all, (void *)flush_delay);
-				if (f)
-					fiber_call(f);
-			} else
-				flush_all((void *)0);
+			struct fiber *f = fiber_create("flush_all", -1, flush_all);
+			if (f)
+				fiber_call(f, flush_delay);
 			iov_add("OK\r\n", 4);
 		}
 	goto st197;
 tr185:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -1029,19 +1023,16 @@ tr185:
 		}
 #line 206 "mod/box/memcached-grammar.rl"
 	{
-			if (flush_delay > 0) {
-				struct fiber *f = fiber_create("flush_all", -1, flush_all, (void *)flush_delay);
-				if (f)
-					fiber_call(f);
-			} else
-				flush_all((void *)0);
+			struct fiber *f = fiber_create("flush_all", -1, flush_all);
+			if (f)
+				fiber_call(f, flush_delay);
 			iov_add("OK\r\n", 4);
 		}
 	goto st197;
 tr195:
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -1060,25 +1051,25 @@ tr195:
 		}
 	goto st197;
 tr213:
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
 			tbuf_peek(&fiber->rbuf, p - (u8 *)fiber->rbuf.data);
 		}
-#line 220 "mod/box/memcached-grammar.rl"
+#line 217 "mod/box/memcached-grammar.rl"
 	{
 			return 0;
 		}
 	goto st197;
 tr233:
-#line 249 "mod/box/memcached-grammar.rl"
+#line 246 "mod/box/memcached-grammar.rl"
 	{bytes = natoq(fstart, p);}
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -1099,7 +1090,7 @@ tr233:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -1116,9 +1107,9 @@ tr233:
 		}
 	goto st197;
 tr237:
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -1139,7 +1130,7 @@ tr237:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -1156,11 +1147,11 @@ tr237:
 		}
 	goto st197;
 tr246:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -1181,7 +1172,7 @@ tr246:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -1198,11 +1189,11 @@ tr246:
 		}
 	goto st197;
 tr263:
-#line 249 "mod/box/memcached-grammar.rl"
+#line 246 "mod/box/memcached-grammar.rl"
 	{bytes = natoq(fstart, p);}
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -1223,7 +1214,7 @@ tr263:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -1236,9 +1227,9 @@ tr263:
 		}
 	goto st197;
 tr267:
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -1259,7 +1250,7 @@ tr267:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -1272,11 +1263,11 @@ tr267:
 		}
 	goto st197;
 tr276:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 254 "mod/box/memcached-grammar.rl"
+#line 251 "mod/box/memcached-grammar.rl"
 	{
 			size_t parsed = p - (u8 *)fiber->rbuf.data;
 			while (fiber->rbuf.size - parsed < bytes + 2) {
@@ -1297,7 +1288,7 @@ tr276:
 				goto exit;
 			}
 		}
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
@@ -1310,15 +1301,15 @@ tr276:
 		}
 	goto st197;
 tr281:
-#line 281 "mod/box/memcached-grammar.rl"
+#line 278 "mod/box/memcached-grammar.rl"
 	{ p++; }
-#line 275 "mod/box/memcached-grammar.rl"
+#line 272 "mod/box/memcached-grammar.rl"
 	{
 			done = true;
 			stats.bytes_read += p - (u8 *)fiber->rbuf.data;
 			tbuf_peek(&fiber->rbuf, p - (u8 *)fiber->rbuf.data);
 		}
-#line 216 "mod/box/memcached-grammar.rl"
+#line 213 "mod/box/memcached-grammar.rl"
 	{
 			print_stats();
 		}
@@ -1327,33 +1318,33 @@ st197:
 	if ( ++p == pe )
 		goto _test_eof197;
 case 197:
-#line 1331 "mod/box/memcached-grammar.m"
+#line 1322 "mod/box/memcached-grammar.m"
 	goto st0;
 tr27:
-#line 249 "mod/box/memcached-grammar.rl"
+#line 246 "mod/box/memcached-grammar.rl"
 	{bytes = natoq(fstart, p);}
 	goto st13;
 tr40:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
 	goto st13;
 st13:
 	if ( ++p == pe )
 		goto _test_eof13;
 case 13:
-#line 1345 "mod/box/memcached-grammar.m"
+#line 1336 "mod/box/memcached-grammar.m"
 	if ( (*p) == 10 )
 		goto tr30;
 	goto st0;
 tr28:
-#line 249 "mod/box/memcached-grammar.rl"
+#line 246 "mod/box/memcached-grammar.rl"
 	{bytes = natoq(fstart, p);}
 	goto st14;
 st14:
 	if ( ++p == pe )
 		goto _test_eof14;
 case 14:
-#line 1357 "mod/box/memcached-grammar.m"
+#line 1348 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 32: goto st14;
 		case 78: goto st15;
@@ -1467,18 +1458,18 @@ case 26:
 		goto tr45;
 	goto st0;
 tr45:
-#line 289 "mod/box/memcached-grammar.rl"
+#line 286 "mod/box/memcached-grammar.rl"
 	{append = true; }
 	goto st27;
 tr209:
-#line 290 "mod/box/memcached-grammar.rl"
+#line 287 "mod/box/memcached-grammar.rl"
 	{append = false;}
 	goto st27;
 st27:
 	if ( ++p == pe )
 		goto _test_eof27;
 case 27:
-#line 1482 "mod/box/memcached-grammar.m"
+#line 1473 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 13: goto st0;
 		case 32: goto st27;
@@ -1487,7 +1478,7 @@ case 27:
 		goto st0;
 	goto tr46;
 tr46:
-#line 225 "mod/box/memcached-grammar.rl"
+#line 222 "mod/box/memcached-grammar.rl"
 	{
 			fstart = p;
 			for (; p < pe && *p != ' ' && *p != '\r' && *p != '\n'; p++);
@@ -1504,7 +1495,7 @@ st28:
 	if ( ++p == pe )
 		goto _test_eof28;
 case 28:
-#line 1508 "mod/box/memcached-grammar.m"
+#line 1499 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st29;
 	goto st0;
@@ -1518,49 +1509,49 @@ case 29:
 		goto tr49;
 	goto st0;
 tr49:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st30;
 st30:
 	if ( ++p == pe )
 		goto _test_eof30;
 case 30:
-#line 1529 "mod/box/memcached-grammar.m"
+#line 1520 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto tr50;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto st30;
 	goto st0;
 tr50:
-#line 248 "mod/box/memcached-grammar.rl"
+#line 245 "mod/box/memcached-grammar.rl"
 	{flags = natoq(fstart, p);}
 	goto st31;
 st31:
 	if ( ++p == pe )
 		goto _test_eof31;
 case 31:
-#line 1543 "mod/box/memcached-grammar.m"
+#line 1534 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st31;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto tr53;
 	goto st0;
 tr53:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st32;
 st32:
 	if ( ++p == pe )
 		goto _test_eof32;
 case 32:
-#line 1557 "mod/box/memcached-grammar.m"
+#line 1548 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto tr54;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto st32;
 	goto st0;
 tr54:
-#line 241 "mod/box/memcached-grammar.rl"
+#line 238 "mod/box/memcached-grammar.rl"
 	{
 			exptime = natoq(fstart, p);
 			if (exptime > 0 && exptime <= 60*60*24*30)
@@ -1571,21 +1562,21 @@ st33:
 	if ( ++p == pe )
 		goto _test_eof33;
 case 33:
-#line 1575 "mod/box/memcached-grammar.m"
+#line 1566 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st33;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto tr57;
 	goto st0;
 tr57:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st34;
 st34:
 	if ( ++p == pe )
 		goto _test_eof34;
 case 34:
-#line 1589 "mod/box/memcached-grammar.m"
+#line 1580 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr58;
 		case 13: goto tr59;
@@ -1595,30 +1586,30 @@ case 34:
 		goto st34;
 	goto st0;
 tr59:
-#line 249 "mod/box/memcached-grammar.rl"
+#line 246 "mod/box/memcached-grammar.rl"
 	{bytes = natoq(fstart, p);}
 	goto st35;
 tr72:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
 	goto st35;
 st35:
 	if ( ++p == pe )
 		goto _test_eof35;
 case 35:
-#line 1610 "mod/box/memcached-grammar.m"
+#line 1601 "mod/box/memcached-grammar.m"
 	if ( (*p) == 10 )
 		goto tr62;
 	goto st0;
 tr60:
-#line 249 "mod/box/memcached-grammar.rl"
+#line 246 "mod/box/memcached-grammar.rl"
 	{bytes = natoq(fstart, p);}
 	goto st36;
 st36:
 	if ( ++p == pe )
 		goto _test_eof36;
 case 36:
-#line 1622 "mod/box/memcached-grammar.m"
+#line 1613 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 32: goto st36;
 		case 78: goto st37;
@@ -1725,7 +1716,7 @@ case 47:
 		goto st0;
 	goto tr76;
 tr76:
-#line 225 "mod/box/memcached-grammar.rl"
+#line 222 "mod/box/memcached-grammar.rl"
 	{
 			fstart = p;
 			for (; p < pe && *p != ' ' && *p != '\r' && *p != '\n'; p++);
@@ -1742,7 +1733,7 @@ st48:
 	if ( ++p == pe )
 		goto _test_eof48;
 case 48:
-#line 1746 "mod/box/memcached-grammar.m"
+#line 1737 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st49;
 	goto st0;
@@ -1756,49 +1747,49 @@ case 49:
 		goto tr78;
 	goto st0;
 tr78:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st50;
 st50:
 	if ( ++p == pe )
 		goto _test_eof50;
 case 50:
-#line 1767 "mod/box/memcached-grammar.m"
+#line 1758 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto tr79;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto st50;
 	goto st0;
 tr79:
-#line 248 "mod/box/memcached-grammar.rl"
+#line 245 "mod/box/memcached-grammar.rl"
 	{flags = natoq(fstart, p);}
 	goto st51;
 st51:
 	if ( ++p == pe )
 		goto _test_eof51;
 case 51:
-#line 1781 "mod/box/memcached-grammar.m"
+#line 1772 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st51;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto tr82;
 	goto st0;
 tr82:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st52;
 st52:
 	if ( ++p == pe )
 		goto _test_eof52;
 case 52:
-#line 1795 "mod/box/memcached-grammar.m"
+#line 1786 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto tr83;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto st52;
 	goto st0;
 tr83:
-#line 241 "mod/box/memcached-grammar.rl"
+#line 238 "mod/box/memcached-grammar.rl"
 	{
 			exptime = natoq(fstart, p);
 			if (exptime > 0 && exptime <= 60*60*24*30)
@@ -1809,49 +1800,49 @@ st53:
 	if ( ++p == pe )
 		goto _test_eof53;
 case 53:
-#line 1813 "mod/box/memcached-grammar.m"
+#line 1804 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st53;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto tr86;
 	goto st0;
 tr86:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st54;
 st54:
 	if ( ++p == pe )
 		goto _test_eof54;
 case 54:
-#line 1827 "mod/box/memcached-grammar.m"
+#line 1818 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto tr87;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto st54;
 	goto st0;
 tr87:
-#line 249 "mod/box/memcached-grammar.rl"
+#line 246 "mod/box/memcached-grammar.rl"
 	{bytes = natoq(fstart, p);}
 	goto st55;
 st55:
 	if ( ++p == pe )
 		goto _test_eof55;
 case 55:
-#line 1841 "mod/box/memcached-grammar.m"
+#line 1832 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st55;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto tr90;
 	goto st0;
 tr90:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st56;
 st56:
 	if ( ++p == pe )
 		goto _test_eof56;
 case 56:
-#line 1855 "mod/box/memcached-grammar.m"
+#line 1846 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr91;
 		case 13: goto tr92;
@@ -1861,30 +1852,30 @@ case 56:
 		goto st56;
 	goto st0;
 tr106:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
 	goto st57;
 tr92:
-#line 250 "mod/box/memcached-grammar.rl"
+#line 247 "mod/box/memcached-grammar.rl"
 	{cas = natoq(fstart, p);}
 	goto st57;
 st57:
 	if ( ++p == pe )
 		goto _test_eof57;
 case 57:
-#line 1876 "mod/box/memcached-grammar.m"
+#line 1867 "mod/box/memcached-grammar.m"
 	if ( (*p) == 10 )
 		goto tr95;
 	goto st0;
 tr93:
-#line 250 "mod/box/memcached-grammar.rl"
+#line 247 "mod/box/memcached-grammar.rl"
 	{cas = natoq(fstart, p);}
 	goto st58;
 st58:
 	if ( ++p == pe )
 		goto _test_eof58;
 case 58:
-#line 1888 "mod/box/memcached-grammar.m"
+#line 1879 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr95;
 		case 13: goto st57;
@@ -1958,14 +1949,14 @@ case 65:
 	}
 	goto st0;
 tr107:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
 	goto st66;
 st66:
 	if ( ++p == pe )
 		goto _test_eof66;
 case 66:
-#line 1969 "mod/box/memcached-grammar.m"
+#line 1960 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr95;
 		case 13: goto st57;
@@ -2009,18 +2000,18 @@ case 70:
 		goto tr113;
 	goto st0;
 tr113:
-#line 298 "mod/box/memcached-grammar.rl"
+#line 295 "mod/box/memcached-grammar.rl"
 	{incr_sign = -1;}
 	goto st71;
 tr202:
-#line 297 "mod/box/memcached-grammar.rl"
+#line 294 "mod/box/memcached-grammar.rl"
 	{incr_sign = 1; }
 	goto st71;
 st71:
 	if ( ++p == pe )
 		goto _test_eof71;
 case 71:
-#line 2024 "mod/box/memcached-grammar.m"
+#line 2015 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 13: goto st0;
 		case 32: goto st71;
@@ -2029,7 +2020,7 @@ case 71:
 		goto st0;
 	goto tr114;
 tr114:
-#line 225 "mod/box/memcached-grammar.rl"
+#line 222 "mod/box/memcached-grammar.rl"
 	{
 			fstart = p;
 			for (; p < pe && *p != ' ' && *p != '\r' && *p != '\n'; p++);
@@ -2046,7 +2037,7 @@ st72:
 	if ( ++p == pe )
 		goto _test_eof72;
 case 72:
-#line 2050 "mod/box/memcached-grammar.m"
+#line 2041 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st73;
 	goto st0;
@@ -2060,14 +2051,14 @@ case 73:
 		goto tr117;
 	goto st0;
 tr117:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st74;
 st74:
 	if ( ++p == pe )
 		goto _test_eof74;
 case 74:
-#line 2071 "mod/box/memcached-grammar.m"
+#line 2062 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr118;
 		case 13: goto tr119;
@@ -2077,30 +2068,30 @@ case 74:
 		goto st74;
 	goto st0;
 tr133:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
 	goto st75;
 tr119:
-#line 251 "mod/box/memcached-grammar.rl"
+#line 248 "mod/box/memcached-grammar.rl"
 	{incr = natoq(fstart, p);}
 	goto st75;
 st75:
 	if ( ++p == pe )
 		goto _test_eof75;
 case 75:
-#line 2092 "mod/box/memcached-grammar.m"
+#line 2083 "mod/box/memcached-grammar.m"
 	if ( (*p) == 10 )
 		goto tr122;
 	goto st0;
 tr120:
-#line 251 "mod/box/memcached-grammar.rl"
+#line 248 "mod/box/memcached-grammar.rl"
 	{incr = natoq(fstart, p);}
 	goto st76;
 st76:
 	if ( ++p == pe )
 		goto _test_eof76;
 case 76:
-#line 2104 "mod/box/memcached-grammar.m"
+#line 2095 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr122;
 		case 13: goto st75;
@@ -2174,14 +2165,14 @@ case 83:
 	}
 	goto st0;
 tr134:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
 	goto st84;
 st84:
 	if ( ++p == pe )
 		goto _test_eof84;
 case 84:
-#line 2185 "mod/box/memcached-grammar.m"
+#line 2176 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr122;
 		case 13: goto st75;
@@ -2234,7 +2225,7 @@ case 89:
 		goto st0;
 	goto tr140;
 tr140:
-#line 225 "mod/box/memcached-grammar.rl"
+#line 222 "mod/box/memcached-grammar.rl"
 	{
 			fstart = p;
 			for (; p < pe && *p != ' ' && *p != '\r' && *p != '\n'; p++);
@@ -2251,7 +2242,7 @@ st90:
 	if ( ++p == pe )
 		goto _test_eof90;
 case 90:
-#line 2255 "mod/box/memcached-grammar.m"
+#line 2246 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr141;
 		case 13: goto st91;
@@ -2259,7 +2250,7 @@ case 90:
 	}
 	goto st0;
 tr147:
-#line 241 "mod/box/memcached-grammar.rl"
+#line 238 "mod/box/memcached-grammar.rl"
 	{
 			exptime = natoq(fstart, p);
 			if (exptime > 0 && exptime <= 60*60*24*30)
@@ -2267,14 +2258,14 @@ tr147:
 		}
 	goto st91;
 tr158:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
 	goto st91;
 st91:
 	if ( ++p == pe )
 		goto _test_eof91;
 case 91:
-#line 2278 "mod/box/memcached-grammar.m"
+#line 2269 "mod/box/memcached-grammar.m"
 	if ( (*p) == 10 )
 		goto tr141;
 	goto st0;
@@ -2293,14 +2284,14 @@ case 92:
 		goto tr144;
 	goto st0;
 tr144:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st93;
 st93:
 	if ( ++p == pe )
 		goto _test_eof93;
 case 93:
-#line 2304 "mod/box/memcached-grammar.m"
+#line 2295 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr146;
 		case 13: goto tr147;
@@ -2310,7 +2301,7 @@ case 93:
 		goto st93;
 	goto st0;
 tr148:
-#line 241 "mod/box/memcached-grammar.rl"
+#line 238 "mod/box/memcached-grammar.rl"
 	{
 			exptime = natoq(fstart, p);
 			if (exptime > 0 && exptime <= 60*60*24*30)
@@ -2321,7 +2312,7 @@ st94:
 	if ( ++p == pe )
 		goto _test_eof94;
 case 94:
-#line 2325 "mod/box/memcached-grammar.m"
+#line 2316 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr141;
 		case 13: goto st91;
@@ -2395,14 +2386,14 @@ case 101:
 	}
 	goto st0;
 tr159:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
 	goto st102;
 st102:
 	if ( ++p == pe )
 		goto _test_eof102;
 case 102:
-#line 2406 "mod/box/memcached-grammar.m"
+#line 2397 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr141;
 		case 13: goto st91;
@@ -2490,18 +2481,18 @@ case 111:
 	}
 	goto st0;
 tr186:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
 	goto st112;
 tr175:
-#line 252 "mod/box/memcached-grammar.rl"
+#line 249 "mod/box/memcached-grammar.rl"
 	{flush_delay = natoq(fstart, p);}
 	goto st112;
 st112:
 	if ( ++p == pe )
 		goto _test_eof112;
 case 112:
-#line 2505 "mod/box/memcached-grammar.m"
+#line 2496 "mod/box/memcached-grammar.m"
 	if ( (*p) == 10 )
 		goto tr169;
 	goto st0;
@@ -2520,14 +2511,14 @@ case 113:
 		goto tr172;
 	goto st0;
 tr172:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st114;
 st114:
 	if ( ++p == pe )
 		goto _test_eof114;
 case 114:
-#line 2531 "mod/box/memcached-grammar.m"
+#line 2522 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr174;
 		case 13: goto tr175;
@@ -2537,14 +2528,14 @@ case 114:
 		goto st114;
 	goto st0;
 tr176:
-#line 252 "mod/box/memcached-grammar.rl"
+#line 249 "mod/box/memcached-grammar.rl"
 	{flush_delay = natoq(fstart, p);}
 	goto st115;
 st115:
 	if ( ++p == pe )
 		goto _test_eof115;
 case 115:
-#line 2548 "mod/box/memcached-grammar.m"
+#line 2539 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr169;
 		case 13: goto st112;
@@ -2618,14 +2609,14 @@ case 122:
 	}
 	goto st0;
 tr187:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
 	goto st123;
 st123:
 	if ( ++p == pe )
 		goto _test_eof123;
 case 123:
-#line 2629 "mod/box/memcached-grammar.m"
+#line 2620 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr169;
 		case 13: goto st112;
@@ -2661,18 +2652,18 @@ case 126:
 	}
 	goto st0;
 tr191:
-#line 294 "mod/box/memcached-grammar.rl"
+#line 291 "mod/box/memcached-grammar.rl"
 	{show_cas = false;}
 	goto st127;
 tr198:
-#line 295 "mod/box/memcached-grammar.rl"
+#line 292 "mod/box/memcached-grammar.rl"
 	{show_cas = true;}
 	goto st127;
 st127:
 	if ( ++p == pe )
 		goto _test_eof127;
 case 127:
-#line 2676 "mod/box/memcached-grammar.m"
+#line 2667 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 13: goto st0;
 		case 32: goto st127;
@@ -2681,7 +2672,7 @@ case 127:
 		goto st0;
 	goto tr193;
 tr193:
-#line 225 "mod/box/memcached-grammar.rl"
+#line 222 "mod/box/memcached-grammar.rl"
 	{
 			fstart = p;
 			for (; p < pe && *p != ' ' && *p != '\r' && *p != '\n'; p++);
@@ -2698,7 +2689,7 @@ st128:
 	if ( ++p == pe )
 		goto _test_eof128;
 case 128:
-#line 2702 "mod/box/memcached-grammar.m"
+#line 2693 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr195;
 		case 13: goto st129;
@@ -2941,7 +2932,7 @@ case 155:
 		goto st0;
 	goto tr222;
 tr222:
-#line 225 "mod/box/memcached-grammar.rl"
+#line 222 "mod/box/memcached-grammar.rl"
 	{
 			fstart = p;
 			for (; p < pe && *p != ' ' && *p != '\r' && *p != '\n'; p++);
@@ -2958,7 +2949,7 @@ st156:
 	if ( ++p == pe )
 		goto _test_eof156;
 case 156:
-#line 2962 "mod/box/memcached-grammar.m"
+#line 2953 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st157;
 	goto st0;
@@ -2972,49 +2963,49 @@ case 157:
 		goto tr224;
 	goto st0;
 tr224:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st158;
 st158:
 	if ( ++p == pe )
 		goto _test_eof158;
 case 158:
-#line 2983 "mod/box/memcached-grammar.m"
+#line 2974 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto tr225;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto st158;
 	goto st0;
 tr225:
-#line 248 "mod/box/memcached-grammar.rl"
+#line 245 "mod/box/memcached-grammar.rl"
 	{flags = natoq(fstart, p);}
 	goto st159;
 st159:
 	if ( ++p == pe )
 		goto _test_eof159;
 case 159:
-#line 2997 "mod/box/memcached-grammar.m"
+#line 2988 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st159;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto tr228;
 	goto st0;
 tr228:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st160;
 st160:
 	if ( ++p == pe )
 		goto _test_eof160;
 case 160:
-#line 3011 "mod/box/memcached-grammar.m"
+#line 3002 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto tr229;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto st160;
 	goto st0;
 tr229:
-#line 241 "mod/box/memcached-grammar.rl"
+#line 238 "mod/box/memcached-grammar.rl"
 	{
 			exptime = natoq(fstart, p);
 			if (exptime > 0 && exptime <= 60*60*24*30)
@@ -3025,21 +3016,21 @@ st161:
 	if ( ++p == pe )
 		goto _test_eof161;
 case 161:
-#line 3029 "mod/box/memcached-grammar.m"
+#line 3020 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st161;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto tr232;
 	goto st0;
 tr232:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st162;
 st162:
 	if ( ++p == pe )
 		goto _test_eof162;
 case 162:
-#line 3043 "mod/box/memcached-grammar.m"
+#line 3034 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr233;
 		case 13: goto tr234;
@@ -3049,30 +3040,30 @@ case 162:
 		goto st162;
 	goto st0;
 tr234:
-#line 249 "mod/box/memcached-grammar.rl"
+#line 246 "mod/box/memcached-grammar.rl"
 	{bytes = natoq(fstart, p);}
 	goto st163;
 tr247:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
 	goto st163;
 st163:
 	if ( ++p == pe )
 		goto _test_eof163;
 case 163:
-#line 3064 "mod/box/memcached-grammar.m"
+#line 3055 "mod/box/memcached-grammar.m"
 	if ( (*p) == 10 )
 		goto tr237;
 	goto st0;
 tr235:
-#line 249 "mod/box/memcached-grammar.rl"
+#line 246 "mod/box/memcached-grammar.rl"
 	{bytes = natoq(fstart, p);}
 	goto st164;
 st164:
 	if ( ++p == pe )
 		goto _test_eof164;
 case 164:
-#line 3076 "mod/box/memcached-grammar.m"
+#line 3067 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 32: goto st164;
 		case 78: goto st165;
@@ -3181,7 +3172,7 @@ case 175:
 		goto st0;
 	goto tr252;
 tr252:
-#line 225 "mod/box/memcached-grammar.rl"
+#line 222 "mod/box/memcached-grammar.rl"
 	{
 			fstart = p;
 			for (; p < pe && *p != ' ' && *p != '\r' && *p != '\n'; p++);
@@ -3198,7 +3189,7 @@ st176:
 	if ( ++p == pe )
 		goto _test_eof176;
 case 176:
-#line 3202 "mod/box/memcached-grammar.m"
+#line 3193 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st177;
 	goto st0;
@@ -3212,49 +3203,49 @@ case 177:
 		goto tr254;
 	goto st0;
 tr254:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st178;
 st178:
 	if ( ++p == pe )
 		goto _test_eof178;
 case 178:
-#line 3223 "mod/box/memcached-grammar.m"
+#line 3214 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto tr255;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto st178;
 	goto st0;
 tr255:
-#line 248 "mod/box/memcached-grammar.rl"
+#line 245 "mod/box/memcached-grammar.rl"
 	{flags = natoq(fstart, p);}
 	goto st179;
 st179:
 	if ( ++p == pe )
 		goto _test_eof179;
 case 179:
-#line 3237 "mod/box/memcached-grammar.m"
+#line 3228 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st179;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto tr258;
 	goto st0;
 tr258:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st180;
 st180:
 	if ( ++p == pe )
 		goto _test_eof180;
 case 180:
-#line 3251 "mod/box/memcached-grammar.m"
+#line 3242 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto tr259;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto st180;
 	goto st0;
 tr259:
-#line 241 "mod/box/memcached-grammar.rl"
+#line 238 "mod/box/memcached-grammar.rl"
 	{
 			exptime = natoq(fstart, p);
 			if (exptime > 0 && exptime <= 60*60*24*30)
@@ -3265,21 +3256,21 @@ st181:
 	if ( ++p == pe )
 		goto _test_eof181;
 case 181:
-#line 3269 "mod/box/memcached-grammar.m"
+#line 3260 "mod/box/memcached-grammar.m"
 	if ( (*p) == 32 )
 		goto st181;
 	if ( 48 <= (*p) && (*p) <= 57 )
 		goto tr262;
 	goto st0;
 tr262:
-#line 224 "mod/box/memcached-grammar.rl"
+#line 221 "mod/box/memcached-grammar.rl"
 	{ fstart = p; }
 	goto st182;
 st182:
 	if ( ++p == pe )
 		goto _test_eof182;
 case 182:
-#line 3283 "mod/box/memcached-grammar.m"
+#line 3274 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 10: goto tr263;
 		case 13: goto tr264;
@@ -3289,30 +3280,30 @@ case 182:
 		goto st182;
 	goto st0;
 tr264:
-#line 249 "mod/box/memcached-grammar.rl"
+#line 246 "mod/box/memcached-grammar.rl"
 	{bytes = natoq(fstart, p);}
 	goto st183;
 tr277:
-#line 283 "mod/box/memcached-grammar.rl"
+#line 280 "mod/box/memcached-grammar.rl"
 	{ noreply = true; }
 	goto st183;
 st183:
 	if ( ++p == pe )
 		goto _test_eof183;
 case 183:
-#line 3304 "mod/box/memcached-grammar.m"
+#line 3295 "mod/box/memcached-grammar.m"
 	if ( (*p) == 10 )
 		goto tr267;
 	goto st0;
 tr265:
-#line 249 "mod/box/memcached-grammar.rl"
+#line 246 "mod/box/memcached-grammar.rl"
 	{bytes = natoq(fstart, p);}
 	goto st184;
 st184:
 	if ( ++p == pe )
 		goto _test_eof184;
 case 184:
-#line 3316 "mod/box/memcached-grammar.m"
+#line 3307 "mod/box/memcached-grammar.m"
 	switch( (*p) ) {
 		case 32: goto st184;
 		case 78: goto st185;
@@ -3627,7 +3618,7 @@ case 196:
 	_out: {}
 	}
 
-#line 308 "mod/box/memcached-grammar.rl"
+#line 305 "mod/box/memcached-grammar.rl"
 
 
 	if (!done) {
diff --git a/mod/box/memcached-grammar.rl b/mod/box/memcached-grammar.rl
index f667886383..03294a6bf7 100644
--- a/mod/box/memcached-grammar.rl
+++ b/mod/box/memcached-grammar.rl
@@ -204,12 +204,9 @@ memcached_dispatch()
 		}
 
 		action flush_all {
-			if (flush_delay > 0) {
-				struct fiber *f = fiber_create("flush_all", -1, flush_all, (void *)flush_delay);
-				if (f)
-					fiber_call(f);
-			} else
-				flush_all((void *)0);
+			struct fiber *f = fiber_create("flush_all", -1, flush_all);
+			if (f)
+				fiber_call(f, flush_delay);
 			iov_add("OK\r\n", 4);
 		}
 
diff --git a/mod/box/memcached.h b/mod/box/memcached.h
index 10d4df108c..bd53bfb3cd 100644
--- a/mod/box/memcached.h
+++ b/mod/box/memcached.h
@@ -45,6 +45,6 @@ memcached_check_config(struct tarantool_cfg *conf);
 void memcached_start_expire();
 void memcached_stop_expire();
 
-void memcached_handler(void * /* data */);
+void memcached_handler(va_list /* ap */);
 
 #endif /* TARANTOOL_MEMCACHED_H_INCLUDED */
diff --git a/mod/box/memcached.m b/mod/box/memcached.m
index a490f1d31f..61af54a016 100644
--- a/mod/box/memcached.m
+++ b/mod/box/memcached.m
@@ -298,9 +298,9 @@ void memcached_get(size_t keys_count, struct tbuf *keys,
 }
 
 static void
-flush_all(void *data)
+flush_all(va_list ap)
 {
-	uintptr_t delay = (uintptr_t)data;
+	uintptr_t delay = va_arg(ap, uintptr_t);
 	fiber_sleep(delay - ev_now());
 	struct tuple *tuple;
 	struct iterator *it = [memcached_index allocIterator];
@@ -333,7 +333,7 @@ do {										\
 #include "memcached-grammar.m"
 
 void
-memcached_handler(void *_data __attribute__((unused)))
+memcached_handler(va_list ap __attribute__((unused)))
 {
 	stats.total_connections++;
 	stats.curr_connections++;
@@ -515,7 +515,7 @@ memcached_delete_expired_keys(struct tbuf *keys_to_delete)
 }
 
 void
-memcached_expire_loop(void *data __attribute__((unused)))
+memcached_expire_loop(va_list ap __attribute__((unused)))
 {
 	struct tuple *tuple = NULL;
 
@@ -557,7 +557,7 @@ void memcached_start_expire()
 
 	assert(memcached_expire == NULL);
 	memcached_expire = fiber_create("memcached_expire", -1,
-					memcached_expire_loop, NULL);
+					memcached_expire_loop);
 	if (memcached_expire == NULL)
 		say_error("can't start the expire fiber");
 	fiber_call(memcached_expire);
diff --git a/src/admin.m b/src/admin.m
index 0bddc99779..7d0fb92e5e 100644
--- a/src/admin.m
+++ b/src/admin.m
@@ -1906,7 +1906,7 @@ case 134:
 }
 
 static void
-admin_handler(void *data __attribute__((unused)))
+admin_handler(va_list ap __attribute__((unused)))
 {
 	lua_State *L = lua_newthread(tarantool_L);
 	int coro_ref = luaL_ref(tarantool_L, LUA_REGISTRYINDEX);
diff --git a/src/admin.rl b/src/admin.rl
index f058e2aeed..1eacd2f38e 100644
--- a/src/admin.rl
+++ b/src/admin.rl
@@ -335,7 +335,7 @@ admin_dispatch(lua_State *L)
 }
 
 static void
-admin_handler(void *data __attribute__((unused)))
+admin_handler(va_list ap __attribute__((unused)))
 {
 	lua_State *L = lua_newthread(tarantool_L);
 	int coro_ref = luaL_ref(tarantool_L, LUA_REGISTRYINDEX);
diff --git a/src/fiber.m b/src/fiber.m
index 09e6ab1bc1..8076c81ee8 100644
--- a/src/fiber.m
+++ b/src/fiber.m
@@ -79,7 +79,7 @@ struct fiber_cleanup {
 struct fiber_server {
 	int port;
 	void *data;
-	void (*handler) (void *data);
+	void (*handler) (va_list ap);
 	void (*on_bind) (void *data);
 };
 
@@ -94,7 +94,7 @@ update_last_stack_frame(struct fiber *fiber)
 }
 
 void
-fiber_call(struct fiber *callee)
+fiber_call(struct fiber *callee, ...)
 {
 	struct fiber *caller = fiber;
 
@@ -107,7 +107,10 @@ fiber_call(struct fiber *callee)
 	update_last_stack_frame(caller);
 
 	callee->csw++;
+
+	va_start(fiber->f_data, callee);
 	coro_transfer(&caller->coro.ctx, &callee->coro.ctx);
+	va_end(fiber->f_data);
 }
 
 
@@ -453,7 +456,7 @@ fiber_set_name(struct fiber *fiber, const char *name)
 
 /* fiber never dies, just become zombie */
 struct fiber *
-fiber_create(const char *name, int fd, void (*f) (void *), void *f_data)
+fiber_create(const char *name, int fd, void (*f) (va_list))
 {
 	struct fiber *fiber = NULL;
 
@@ -484,7 +487,7 @@ fiber_create(const char *name, int fd, void (*f) (void *), void *f_data)
 
 	fiber->fd = fd;
 	fiber->f = f;
-	fiber->f_data = f_data;
+	memset(&fiber->f_data, 0, sizeof(fiber->f_data)); /* safety */
 	while (++last_used_fid <= 100) ;	/* fids from 0 to 100 are reserved */
 	fiber->fid = last_used_fid;
 	fiber->flags = 0;
@@ -778,9 +781,9 @@ set_nonblock(int sock)
 }
 
 static void
-tcp_server_handler(void *data)
+tcp_server_handler(va_list ap)
 {
-	struct fiber_server *server = (void*) data;
+	struct fiber_server *server = va_arg(ap, struct fiber_server *);
 	struct fiber *h;
 	char name[FIBER_NAME_MAXLEN];
 	int fd;
@@ -812,7 +815,7 @@ tcp_server_handler(void *data)
 			}
 
 			snprintf(name, sizeof(name), "%i/handler", server->port);
-			h = fiber_create(name, fd, server->handler, server->data);
+			h = fiber_create(name, fd, server->handler);
 			if (h == NULL) {
 				say_error("can't create handler fiber, dropping client connection");
 				close(fd);
@@ -820,7 +823,7 @@ tcp_server_handler(void *data)
 			}
 
 			h->has_peer = true;
-			fiber_call(h);
+			fiber_call(h, server->data);
 		}
 		if (fd < 0 && errno != EAGAIN && errno != EWOULDBLOCK) {
 			say_syserror("accept");
@@ -831,7 +834,7 @@ tcp_server_handler(void *data)
 }
 
 struct fiber *
-fiber_server(const char *name, int port, void (*handler) (void *data), void *data,
+fiber_server(const char *name, int port, void (*handler) (va_list ap), void *data,
 	     void (*on_bind) (void *data))
 {
 	char server_name[FIBER_NAME_MAXLEN];
@@ -845,9 +848,9 @@ fiber_server(const char *name, int port, void (*handler) (void *data), void *dat
 	server->port = port;
 	server->handler = handler;
 	server->on_bind = on_bind;
-	s = fiber_create(server_name, -1, tcp_server_handler, server);
+	s = fiber_create(server_name, -1, tcp_server_handler);
 
-	fiber_call(s);		/* give a handler a chance */
+	fiber_call(s, server);		/* give a handler a chance */
 	return s;
 }
 
diff --git a/src/iproto.m b/src/iproto.m
index 66e321167e..446c64c92c 100644
--- a/src/iproto.m
+++ b/src/iproto.m
@@ -63,8 +63,9 @@ iproto_flush(ssize_t to_read)
 }
 
 void
-iproto_interact(iproto_callback callback)
+iproto_interact(va_list ap)
 {
+	iproto_callback callback = va_arg(ap, iproto_callback);
 	struct tbuf *in = &fiber->rbuf;
 	ssize_t to_read = sizeof(struct iproto_header);
 
diff --git a/src/replica.m b/src/replica.m
index 121403d0b1..c36384d002 100644
--- a/src/replica.m
+++ b/src/replica.m
@@ -118,9 +118,9 @@ remote_read_row(struct sockaddr_in *remote_addr, i64 initial_lsn)
 }
 
 static void
-pull_from_remote(void *state)
+pull_from_remote(va_list ap)
 {
-	struct recovery_state *r = state;
+	struct recovery_state *r = va_arg(ap, struct recovery_state *);
 	struct tbuf *row;
 
 	for (;;) {
@@ -185,7 +185,7 @@ recovery_follow_remote(struct recovery_state *r, const char *addr)
 	say_crit("initializing the replica, WAL master %s", addr);
 	snprintf(name, sizeof(name), "replica/%s", addr);
 
-	f = fiber_create(name, -1, pull_from_remote, r);
+	f = fiber_create(name, -1, pull_from_remote);
 	if (f == NULL)
 		return;
 
@@ -206,7 +206,7 @@ recovery_follow_remote(struct recovery_state *r, const char *addr)
 	memcpy(&remote.cookie, &remote.addr, MIN(sizeof(remote.cookie), sizeof(remote.addr)));
 	remote.reader = f;
 	r->remote = &remote;
-	fiber_call(f);
+	fiber_call(f, r);
 }
 
 void
diff --git a/src/tarantool_lua.m b/src/tarantool_lua.m
index 6599118667..e98759392e 100644
--- a/src/tarantool_lua.m
+++ b/src/tarantool_lua.m
@@ -679,7 +679,7 @@ lbox_fiber_detach(struct lua_State *L)
 }
 
 static void
-box_lua_fiber_run(void *arg __attribute__((unused)))
+box_lua_fiber_run(va_list ap __attribute__((unused)))
 {
 	fiber_testcancel();
 	fiber_setcancelstate(false);
@@ -781,7 +781,7 @@ lbox_fiber_create(struct lua_State *L)
 		luaL_error(L, "fiber.create(function): recursion limit"
 			   " reached");
 
-	struct fiber *f = fiber_create("lua", -1, box_lua_fiber_run, NULL);
+	struct fiber *f = fiber_create("lua", -1, box_lua_fiber_run);
 	/* Initially the fiber is cancellable */
 	f->flags |= FIBER_USER_MODE | FIBER_CANCELLABLE;
 
@@ -1426,9 +1426,9 @@ tarantool_lua_load_cfg(struct lua_State *L, struct tarantool_cfg *cfg)
  * Load start-up file routine.
  */
 static void
-load_init_script(void *L_ptr)
+load_init_script(va_list ap)
 {
-	struct lua_State *L = (struct lua_State *) L_ptr;
+	struct lua_State *L = va_arg(ap, struct lua_State *);
 
 	char path[PATH_MAX + 1];
 	snprintf(path, PATH_MAX, "%s/%s",
@@ -1485,8 +1485,8 @@ tarantool_lua_load_init_script(struct lua_State *L)
 	 * a separate fiber.
 	 */
 	struct fiber *loader = fiber_create(TARANTOOL_LUA_INIT_SCRIPT, -1,
-					    load_init_script, L);
-	fiber_call(loader);
+					    load_init_script);
+	fiber_call(loader, L);
 	/* Outside the startup file require() or ffi are not
 	 * allowed.
 	*/
-- 
GitLab