10000 Fix compile time errors for redis.c · jrtkcoder/phpredis@97fcfe6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 97fcfe6

Browse files
committed
Fix compile time errors for redis.c
1 parent 77e6200 commit 97fcfe6

File tree

7 files changed

+413
-455
lines changed

7 files changed

+413
-455
lines changed

cluster_library.h

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ typedef struct redisCluster {
230230
/* One RedisSock struct for serialization and prefix information */
231231
RedisSock *flags;
232232

233-
/* The first line of our last reply, not including our reply type byte
233+
/* The first line of our last reply, not including our reply type byte
234234
* or the trailing \r\n */
235235
char line_reply[1024];
236236

@@ -278,7 +278,7 @@ typedef struct clusterDistList {
278278
size_t len, size;
279279
} clusterDistList;
280280

281-
/* Context for things like MGET/MSET/MSETNX. When executing in MULTI mode,
281+
/* Context for things like MGET/MSET/MSETNX. When executing in MULTI mode,
282282
* we'll want to re-integrate into one running array, except for the last
283283
* command execution, in which we'll want to return the value (or add it) */
284284
typedef struct clusterMultiCtx {
@@ -303,8 +303,8 @@ typedef struct clusterMultiCmd {
303303
int argc;
304304

305305
/* The full command, built into cmd, and args as we aggregate */
306-
smart_str cmd;
307-
smart_str args;
306+
smart_string cmd;
307+
smart_string args;
308308
} clusterMultiCmd;
309309

310310
/* Hiredis like structure for processing any sort of reply Redis Cluster might
@@ -321,16 +321,16 @@ typedef struct clusterReply {
321321

322322
/* Direct variant response handler */
323323
clusterReply *cluster_read_resp(redisCluster *c TSRMLS_DC);
324-
clusterReply *cluster_read_sock_resp(RedisSock *redis_sock,
324+
clusterReply *cluster_read_sock_resp(RedisSock *redis_sock,
325325
REDIS_REPLY_TYPE type, size_t reply_len TSRMLS_DC);
326326
void cluster_free_reply(clusterReply *reply, int free_data);
327327

328328
/* Cluster distribution helpers for WATCH */
329329
HashTable *cluster_dist_create();
330330
void cluster_dist_free(HashTable *ht);
331-
int cluster_dist_add_key(redisCluster *c, HashTable *ht, char *key,
331+
int cluster_dist_add_key(redisCluster *c, HashTable *ht, char *key,
332332
int key_len, clusterKeyVal **kv);
333-
void cluster_dist_add_val(redisCluster *c, clusterKeyVal *kv, zval *val
333+
void cluster_dist_add_val(redisCluster *c, clusterKeyVal *kv, zval *val
334334
TSRMLS_DC);
335335

336336
/* Aggregation for multi commands like MGET, MSET, and MSETNX */
@@ -346,7 +346,7 @@ unsigned short cluster_hash_key(const char *key, int len);
346346
/* Get the current time in miliseconds */
347347
long long mstime(void);
348348

349-
PHP_REDIS_API short cluster_send_command(redisCluster *c, short slot, const char *cmd,
349+
PHP_REDIS_API short cluster_send_command(redisCluster *c, short slot, const char *cmd,
350350
int cmd_len TSRMLS_DC);
351351

352352
PHP_REDIS_API void cluster_disconnect(redisCluster *c TSRMLS_DC);
@@ -358,7 +358,7 @@ PHP_REDIS_API int cluster_reset_multi(redisCluster *c);
358358

359359
PHP_REDIS_API short cluster_find_slot(redisCluster *c, const char *host,
360360
unsigned short port);
361-
PHP_REDIS_API int cluster_send_slot(redisCluster *c, short slot, char *cmd,
361+
PHP_REDIS_API int cluster_send_slot(redisCluster *c, short slot, char *cmd,
362362
int cmd_len, REDIS_REPLY_TYPE rtype TSRMLS_DC);
363363

364364
PHP_REDIS_API redisCluster *cluster_create(double timeout, double read_timeout,
@@ -374,28 +374,28 @@ PHP_REDIS_API char **cluster_sock_read_multibulk_reply(RedisSock *redis_sock,
374374
/*
375375
* Redis Cluster response handlers. Our response handlers generally take the
376376
* following form:
377-
* PHP_REDIS_API void handler(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
377+
* PHP_REDIS_API void handler(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
378378
* void *ctx)
379379
*
380380
* Reply handlers are responsible for setting the PHP return value (either to
381381
* something valid, or FALSE in the case of some failures).
382382
*/
383383

384-
PHP_REDIS_API void cluster_bool_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
384+
PHP_REDIS_API void cluster_bool_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
385385
void *ctx);
386386
PHP_REDIS_API void cluster_ping_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
387387
void *ctx);
388-
PHP_REDIS_API void cluster_bulk_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
388+
PHP_REDIS_API void cluster_bulk_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
389389
void *ctx);
390-
PHP_REDIS_API void cluster_bulk_raw_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
390+
PHP_REDIS_API void cluster_bulk_raw_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
391391
B41A void *ctx);
392-
PHP_REDIS_API void cluster_dbl_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
392+
PHP_REDIS_API void cluster_dbl_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
393393
void *ctx);
394-
PHP_REDIS_API void cluster_1_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
394+
PHP_REDIS_API void cluster_1_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
395395
void *ctx);
396-
PHP_REDIS_API void cluster_long_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
396+
PHP_REDIS_API void cluster_long_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
397397
void *ctx);
398-
PHP_REDIS_API void cluster_type_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
398+
PHP_REDIS_API void cluster_type_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
399399
void *ctx);
400400
PHP_REDIS_API void cluster_sub_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
401401
void *ctx);
@@ -407,27 +407,27 @@ PHP_REDIS_API void cluster_variant_resp(INTERNAL_FUNCTION_PARAMETERS,
407407
redisCluster *c, void *ctx);
408408

409409
/* MULTI BULK response functions */
410-
PHP_REDIS_API void cluster_gen_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
410+
PHP_REDIS_API void cluster_gen_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
411411
redisCluster *c, mbulk_cb func, void *ctx);
412-
PHP_REDIS_API void cluster_mbulk_raw_resp(INTERNAL_FUNCTION_PARAMETERS,
412+
PHP_REDIS_API void cluster_mbulk_raw_resp(INTERNAL_FUNCTION_PARAMETERS,
413413
redisCluster *c, void *ctx);
414-
PHP_REDIS_API void cluster_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
414+
PHP_REDIS_API void cluster_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
415415
redisCluster *c, void *ctx);
416416
PHP_REDIS_API void cluster_mbulk_zipstr_resp(INTERNAL_FUNCTION_PARAMETERS,
417417
redisCluster *c, void *ctx);
418418
PHP_REDIS_API void cluster_mbulk_zipdbl_resp(INTERNAL_FUNCTION_PARAMETERS,
419419
redisCluster *c, void *ctx);
420-
PHP_REDIS_API void cluster_mbulk_assoc_resp(INTERNAL_FUNCTION_PARAMETERS,
420+
PHP_REDIS_API void cluster_mbulk_assoc_resp(INTERNAL_FUNCTION_PARAMETERS,
421421
redisCluster *c, void *ctx);
422422
PHP_REDIS_API void cluster_multi_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
423423
redisCluster *c, void *ctx);
424-
PHP_REDIS_API zval *cluster_zval_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
424+
PHP_REDIS_API zval *cluster_zval_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
425425
redisCluster *c, int pull, mbulk_cb cb);
426426

427427
/* Handlers for things like DEL/MGET/MSET/MSETNX */
428-
PHP_REDIS_API void cluster_del_resp(INTERNAL_FUNCTION_PARAMETERS,
428+
PHP_REDIS_API void cluster_del_resp(INTERNAL_FUNCTION_PARAMETERS,
429429
redisCluster *c, void *ctx);
430-
PHP_REDIS_API void cluster_mbulk_mget_resp(INTERNAL_FUNCTION_PARAMETERS,
430+
PHP_REDIS_API void cluster_mbulk_mget_resp(INTERNAL_FUNCTION_PARAMETERS,
431431
redisCluster *c, void *ctx);
432432
PHP_REDIS_API void cluster_mset_resp(INTERNAL_FUNCTION_PARAMETERS,
433433
redisCluster *c, void *ctx);
@@ -443,13 +443,13 @@ PHP_REDIS_API void cluster_info_resp(INTERNAL_FUNCTION_PARAMETERS,
443443
redisCluster *c, void *ctx);
444444

445445
/* CLIENT LIST response handler */
446-
PHP_REDIS_API void cluster_client_list_resp(INTERNAL_FUNCTION_PARAMETERS,
446+
PHP_REDIS_API void cluster_client_list_resp(INTERNAL_FUNCTION_PARAMETERS,
447447
redisCluster *c, void *ctx);
448448

449449
/* MULTI BULK processing callbacks */
450-
int mbulk_resp_loop(RedisSock *redis_sock, zval *z_result,
450+
int mbulk_resp_loop(RedisSock *redis_sock, zval *z_result,
451451
long long count, void *ctx TSRMLS_DC);
452-
int mbulk_resp_loop_raw(RedisSock *redis_sock, zval *z_result,
452+
int mbulk_resp_loop_raw(RedisSock *redis_sock, zval *z_result,
453453
long long count, void *ctx TSRMLS_DC);
454454
int mbulk_resp_loop_zipstr(RedisSock *redis_sock, zval *z_result,
455455
long long count, void *ctx TSRMLS_DC);

common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "php.h" EF5E
22
#include "php_ini.h"
3-
#include <ext/standard/php_smart_str.h>
3+
#include <ext/standard/php_smart_string.h>
44

55
#ifndef REDIS_COMMON_H
66
#define REDIS_COMMON_H
@@ -213,7 +213,7 @@ typedef enum _PUBSUB_TYPE {
213213
} \
214214
REDIS_PROCESS_RESPONSE_CLOSURE(resp_func,ctx);
215215

216-
/* Process a command but with a specific command building function
216+
/* Process a command but with a specific command building function
217217
* and keyword which is passed to us*/
218218
#define REDIS_PROCESS_KW_CMD(kw, cmdfunc, resp_func) \
219219
RedisSock *redis_sock; char *cmd; int cmd_len; void *ctx=NULL; \
@@ -256,7 +256,7 @@ typedef struct fold_item {
256256
} fold_item;
257257

258258
typedef struct request_item {
259-
char *request_str;
259+
char *request_str;
260260
int request_size; /* size_t */
261261
struct request_item *next;
262262
} request_item;

library.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ int redis_cmd_format(char **ret, char *format, ...);
77
int redis_cmd_format_static(char **ret, char *keyword, char *format, ...);
88
int redis_cmd_format_header(char **ret, char *keyword, int arg_count);
99
int redis_cmd_append_str(char **cmd, int cmd_len, char *append, int append_len);
10-
int redis_cmd_init_sstr(smart_str *str, int num_args, char *keyword, int keyword_len);
11-
int redis_cmd_append_sstr(smart_str *str, char *append, int append_len);
12-
int redis_cmd_append_sstr_int(smart_str *str, int append);
13-
int redis_cmd_append_sstr_long(smart_str *str, long append);
10+
int redis_cmd_init_sstr(smart_string *str, int num_args, char *keyword, int keyword_len);
11+
int redis_cmd_append_sstr(smart_string *str, char *append, int append_len);
12+
int redis_cmd_append_sstr_int(smart_string *str, int append);
13+
int redis_cmd_append_sstr_long(smart_string *str, long append);
1414
int redis_cmd_append_int(char **cmd, int cmd_len, int append);
15-
int redis_cmd_append_sstr_dbl(smart_str *str, double value);
15+
int redis_cmd_append_sstr_dbl(smart_string *str, double value);
1616

1717
PHP_REDIS_API char * redis_sock_read(RedisSock *redis_sock, int *buf_len TSRMLS_DC);
1818
PHP_REDIS_API int redis_sock_gets(RedisSock *redis_sock, char *buf, int buf_size, size_t* line_len TSRMLS_DC);
@@ -46,7 +46,7 @@ PHP_REDIS_API int redis_mbulk_reply_assoc(INTERNAL_FUNCTION_PARAMETERS, RedisSoc
4646

4747
PHP_REDIS_API int redis_sock_read_scan_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock, REDIS_SCAN_TYPE type, long *iter);
4848

49-
PHP_REDIS_API int redis_subscribe_response(INTERNAL_FUNCTION_PARAMETERS,
49+
PHP_REDIS_API int redis_subscribe_response(INTERNAL_FUNCTION_PARAMETERS,
5050
RedisSock *redis_sock, zval *z_tab, void *ctx);
5151
PHP_REDIS_API int redis_unsubscribe_response(INTERNAL_FUNCTION_PARAMETERS,
5252
RedisSock *redis_sock, zval *z_tab, void *ctx);

0 commit comments

Comments
 (0)
0