~alexlawn/php-redis/alex-redis-hmget

« back to all changes in this revision

Viewing changes to cluster_library.c

  • Committer: GitHub
  • Author(s): Pavlo Yatsukhnenko
  • Date: 2016-09-06 17:49:48 UTC
  • mfrom: (526.2.4)
  • Revision ID: git-v1:8eae7ec092be67cbda5e47d95bd42d5b082116ca
Merge pull request #939 from yatsukhnenko/develop

WIP: php7 compatibility

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
// Debug function to dump a clusterReply structure recursively 
43
43
static void dump_reply(clusterReply *reply, int indent) {
44
 
    smart_str buf = {0};
 
44
    smart_string buf = {0};
45
45
    int i;
46
46
 
47
47
    switch(reply->type) {
48
48
        case TYPE_ERR:
49
 
            smart_str_appendl(&buf, "(error) ", sizeof("(error) ")-1);
50
 
            smart_str_appendl(&buf, reply->str, reply->len);
 
49
            smart_string_appendl(&buf, "(error) ", sizeof("(error) ")-1);
 
50
            smart_string_appendl(&buf, reply->str, reply->len);
51
51
            break;
52
52
        case TYPE_LINE:
53
 
            smart_str_appendl(&buf, reply->str, reply->len);
 
53
            smart_string_appendl(&buf, reply->str, reply->len);
54
54
            break;
55
55
        case TYPE_INT:
56
 
            smart_str_appendl(&buf, "(integer) ", sizeof("(integer) ")-1);
57
 
            smart_str_append_long(&buf, reply->integer);
 
56
            smart_string_appendl(&buf, "(integer) ", sizeof("(integer) ")-1);
 
57
            smart_string_append_long(&buf, reply->integer);
58
58
            break;
59
59
        case TYPE_BULK:
60
 
            smart_str_appendl(&buf,"\"", 1);
61
 
            smart_str_appendl(&buf, reply->str, reply->len);
62
 
            smart_str_appendl(&buf, "\"", 1);
 
60
            smart_string_appendl(&buf,"\"", 1);
 
61
            smart_string_appendl(&buf, reply->str, reply->len);
 
62
            smart_string_appendl(&buf, "\"", 1);
63
63
            break;
64
64
        case TYPE_MULTIBULK:
65
65
            if(reply->elements == (size_t)-1) {
66
 
                smart_str_appendl(&buf, "(nil)", sizeof("(nil)")-1);
 
66
                smart_string_appendl(&buf, "(nil)", sizeof("(nil)")-1);
67
67
            } else {
68
68
                for(i=0;i<reply->elements;i++) {
69
69
                    dump_reply(reply->element[i], indent+2);
79
79
            php_printf(" ");
80
80
        }
81
81
 
82
 
        smart_str_0(&buf);
 
82
        smart_string_0(&buf);
83
83
        php_printf("%s", buf.c);
84
84
        php_printf("\n");
85
85
 
478
478
void cluster_multi_fini(clusterMultiCmd *mc) {
479
479
    mc->cmd.len = 0;
480
480
    redis_cmd_init_sstr(&(mc->cmd), mc->argc, mc->kw, mc->kw_len);
481
 
    smart_str_appendl(&(mc->cmd), mc->args.c, mc->args.len);
 
481
    smart_string_appendl(&(mc->cmd), mc->args.c, mc->args.len);
482
482
}
483
483
 
484
484
/* Set our last error string encountered */
2464
2464
    return SUCCESS;
2465
2465
}
2466
2466
 
2467
 
/* vim: set tabstop=4 softtabstops=4 noexpandtab shiftwidth=4: */
 
2467
/* vim: set tabstop=4 softtabstop=4 expandtab shiftwidth=4: */