Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 00be281

Browse files
committed
C89 compat
1 parent 792a71d commit 00be281

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

library.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -564,12 +564,13 @@ int redis_cmd_append_sstr_long(smart_str *str, long append) {
564564
int redis_cmd_append_sstr_dbl(smart_str *str, double value) {
565565
char *dbl_str;
566566
int dbl_len;
567+
int retval;
567568

568569
/// Convert to double
569570
REDIS_DOUBLE_TO_STRING(dbl_str, dbl_len, value);
570571

571572
// Append the string
572-
int retval = redis_cmd_append_sstr(str, dbl_str, dbl_len);
573+
retval = redis_cmd_append_sstr(str, dbl_str, dbl_len);
573574

574575
// Free our double string
575576
efree(dbl_str);
@@ -583,9 +584,10 @@ int redis_cmd_append_sstr_dbl(smart_str *str, double value) {
583584
*/
584585
int redis_cmd_append_int(char **cmd, int cmd_len, int append) {
585586
char int_buf[32];
587+
int int_len;
586588

587589
// Conver to an int, capture length
588-
int int_len = snprintf(int_buf, sizeof(int_buf), "%d", append);
590+
int_len = snprintf(int_buf, sizeof(int_buf), "%d", append);
589591

590592
// Return the new length
591593
return redis_cmd_append_str(cmd, cmd_len, int_buf, int_len);
@@ -733,6 +735,10 @@ PHPAPI void redis_client_list_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSock *red
733735
char *resp;
734736
int resp_len;
735737
zval *z_result, *z_sub_result;
738+
// Pointers for parsing
739+
char *p, *lpos, *kpos = NULL, *vpos = NULL, *p2, *key, *value;
740+
// Key length, done flag
741+
int klen = 0, done = 0, is_numeric;
736742

737743
// Make sure we can read a response from Redis
738744
if((resp = redis_sock_read(redis_sock, &resp_len TSRMLS_CC)) == NULL) {
@@ -747,11 +753,8 @@ PHPAPI void redis_client_list_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSock *red
747753
ALLOC_INIT_ZVAL(z_sub_result);
748754
array_init(z_sub_result);
749755

750-
// Pointers for parsing
751-
char *p = resp, *lpos = resp, *kpos = NULL, *vpos = NULL, *p2, *key, *value;
752-
753-
// Key length, done flag
754-
int klen = 0, done = 0, is_numeric;
756+
p = resp;
757+
lpos = resp;
755758

756759
// While we've got more to parse
757760
while(!done) {

0 commit comments

Comments
 (0)