@@ -17,6 +17,7 @@ extern "C" {
17
17
} /* extern "C" */
18
18
#endif
19
19
20
+ #define NEED_newRV_noinc
20
21
#define NEED_my_strlcpy
21
22
#include "ppport.h"
22
23
@@ -214,14 +215,11 @@ cluster_node *get_node_by_random(pTHX_ Redis__Cluster__Fast self) {
214
215
215
216
void Redis__Cluster__Fast_run_cmd (pTHX_ Redis__Cluster__Fast self , int argc , const char * * argv , size_t * argvlen ,
216
217
cmd_reply_context_t * reply_t ) {
217
- char * cmd ;
218
- int len , status , event_loop_error ;
218
+ int status , event_loop_error ;
219
219
pid_t current_pid ;
220
220
221
221
DEBUG_MSG ("start: %s" , * argv );
222
222
223
- cmd = NULL ;
224
-
225
223
reply_t -> done = 0 ;
226
224
reply_t -> self = (void * ) self ;
227
225
reply_t -> result = NULL ;
@@ -232,20 +230,13 @@ void Redis__Cluster__Fast_run_cmd(pTHX_ Redis__Cluster__Fast self, int argc, con
232
230
DEBUG_MSG ("%s" , "pid changed" );
233
231
if (event_reinit (self -> cluster_event_base ) != 0 ) {
234
232
reply_t -> error = newSVpvf ("%s" , "event reinit failed" );
235
- goto end ;
233
+ return ;
236
234
}
237
235
redisClusterAsyncDisconnect (self -> acc );
238
236
self -> pid = current_pid ;
239
237
}
240
238
241
- len = (int ) redisFormatCommandArgv (& cmd , argc , argv , argvlen );
242
- if (len == -1 ) {
243
- DEBUG_MSG ("error: err=%s" , "memory error" );
244
- reply_t -> error = newSVpvf ("%s" , "memory allocation error" );
245
- goto end ;
246
- }
247
-
248
- status = redisClusterAsyncFormattedCommand (self -> acc , replyCallback , reply_t , cmd , len );
239
+ status = redisClusterAsyncCommandArgv (self -> acc , replyCallback , reply_t , argc , argv , argvlen );
249
240
if (status != REDIS_OK ) {
250
241
if (self -> acc -> err == REDIS_ERR_OTHER &&
251
242
strcmp (self -> acc -> errstr , "No keys in command(must have keys for redis cluster mode)" ) == 0 ) {
@@ -258,19 +249,19 @@ void Redis__Cluster__Fast_run_cmd(pTHX_ Redis__Cluster__Fast self, int argc, con
258
249
node = get_node_by_random (aTHX_ self );
259
250
if (node == NULL ) {
260
251
reply_t -> error = newSVpvf ("%s" , "No node found" );
261
- goto end ;
252
+ return ;
262
253
}
263
254
264
- status = redisClusterAsyncFormattedCommandToNode (self -> acc , node , replyCallback , reply_t , cmd , len );
255
+ status = redisClusterAsyncCommandArgvToNode (self -> acc , node , replyCallback , reply_t , argc , argv , argvlen );
265
256
if (status != REDIS_OK ) {
266
257
DEBUG_MSG ("error: err=%d errstr=%s" , self -> acc -> err , self -> acc -> errstr );
267
258
reply_t -> error = newSVpvf ("%s" , self -> acc -> errstr );
268
- goto end ;
259
+ return ;
269
260
}
270
261
} else {
271
262
DEBUG_MSG ("error: err=%d errstr=%s" , self -> acc -> err , self -> acc -> errstr );
272
263
reply_t -> error = newSVpvf ("%s" , self -> acc -> errstr );
273
- goto end ;
264
+ return ;
274
265
}
275
266
}
276
267
@@ -282,10 +273,6 @@ void Redis__Cluster__Fast_run_cmd(pTHX_ Redis__Cluster__Fast self, int argc, con
282
273
break ;
283
274
}
284
275
}
285
-
286
- end :
287
- if (cmd != NULL )
288
- hi_free (cmd );
289
276
}
290
277
291
278
MODULE = Redis ::Cluster ::Fast PACKAGE = Redis ::Cluster ::Fast
0 commit comments