Skip to content

Commit 67b7628

Browse files
committed
Fixed compiler warnings
1 parent 8ee6495 commit 67b7628

File tree

1 file changed

+37
-39
lines changed

1 file changed

+37
-39
lines changed

php_memcached.c

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,6 @@ PHP_METHOD(Memcached, addServers)
17721772
Returns the list of the memcache servers in use */
17731773
PHP_METHOD(Memcached, getServerList)
17741774
{
1775-
zval *array;
17761775
struct callbackContext context = {0};
17771776
memcached_server_function callbacks[1];
17781777
MEMC_METHOD_INIT_VARS;
@@ -1785,7 +1784,6 @@ PHP_METHOD(Memcached, getServerList)
17851784

17861785
callbacks[0] = php_memc_do_serverlist_callback;
17871786
array_init(return_value);
1788-
context.array = array;
17891787
context.return_value = return_value;
17901788
memcached_server_cursor(m_obj->memc, callbacks, &context, 1);
17911789
}
@@ -1833,7 +1831,6 @@ PHP_METHOD(Memcached, getStats)
18331831
{
18341832
memcached_stat_st *stats;
18351833
memcached_return status;
1836-
zval *entry;
18371834
struct callbackContext context = {0};
18381835
memcached_server_function callbacks[1];
18391836
MEMC_METHOD_INIT_VARS;
@@ -1857,7 +1854,6 @@ PHP_METHOD(Memcached, getStats)
18571854

18581855
callbacks[0] = php_memc_do_stats_callback;
18591856
context.i = 0;
1860-
context.entry = entry;
18611857
context.stats = stats;
18621858
context.return_value = return_value;
18631859
memcached_server_cursor(m_obj->memc, callbacks, &context, 1);
@@ -2349,13 +2345,14 @@ ZEND_RSRC_DTOR_FUNC(php_memc_dtor)
23492345
static memcached_return php_memc_do_serverlist_callback(const memcached_st *ptr, memcached_server_instance_st instance, void *in_context)
23502346
{
23512347
struct callbackContext* context = (struct callbackContext*) in_context;
2348+
zval *array;
23522349

2353-
MAKE_STD_ZVAL(context->array);
2354-
array_init(context->array);
2355-
add_assoc_string(context->array, "host", instance->hostname, 1);
2356-
add_assoc_long(context->array, "port", instance->port);
2357-
add_assoc_long(context->array, "weight", instance->weight);
2358-
add_next_index_zval(context->return_value, context->array);
2350+
MAKE_STD_ZVAL(array);
2351+
array_init(array);
2352+
add_assoc_string(array, "host", instance->hostname, 1);
2353+
add_assoc_long(array, "port", instance->port);
2354+
add_assoc_long(array, "weight", instance->weight);
2355+
add_next_index_zval(context->return_value, array);
23592356
return MEMCACHED_SUCCESS;
23602357
}
23612358

@@ -2364,37 +2361,38 @@ static memcached_return php_memc_do_stats_callback(const memcached_st *ptr, memc
23642361
char *hostport = NULL;
23652362
int hostport_len;
23662363
struct callbackContext* context = (struct callbackContext*) in_context;
2364+
zval *entry;
23672365
hostport_len = spprintf(&hostport, 0, "%s:%d", instance->hostname, instance->port);
23682366

2369-
MAKE_STD_ZVAL(context->entry);
2370-
array_init(context->entry);
2371-
2372-
add_assoc_long(context->entry, "pid", context->stats[context->i].pid);
2373-
add_assoc_long(context->entry, "uptime", context->stats[context->i].uptime);
2374-
add_assoc_long(context->entry, "threads", context->stats[context->i].threads);
2375-
add_assoc_long(context->entry, "time", context->stats[context->i].time);
2376-
add_assoc_long(context->entry, "pointer_size", context->stats[context->i].pointer_size);
2377-
add_assoc_long(context->entry, "rusage_user_seconds", context->stats[context->i].rusage_user_seconds);
2378-
add_assoc_long(context->entry, "rusage_user_microseconds", context->stats[context->i].rusage_user_microseconds);
2379-
add_assoc_long(context->entry, "rusage_system_seconds", context->stats[context->i].rusage_system_seconds);
2380-
add_assoc_long(context->entry, "rusage_system_microseconds", context->stats[context->i].rusage_system_microseconds);
2381-
add_assoc_long(context->entry, "curr_items", context->stats[context->i].curr_items);
2382-
add_assoc_long(context->entry, "total_items", context->stats[context->i].total_items);
2383-
add_assoc_long(context->entry, "limit_maxbytes", context->stats[context->i].limit_maxbytes);
2384-
add_assoc_long(context->entry, "curr_connections", context->stats[context->i].curr_connections);
2385-
add_assoc_long(context->entry, "total_connections", context->stats[context->i].total_connections);
2386-
add_assoc_long(context->entry, "connection_structures", context->stats[context->i].connection_structures);
2387-
add_assoc_long(context->entry, "bytes", context->stats[context->i].bytes);
2388-
add_assoc_long(context->entry, "cmd_get", context->stats[context->i].cmd_get);
2389-
add_assoc_long(context->entry, "cmd_set", context->stats[context->i].cmd_set);
2390-
add_assoc_long(context->entry, "get_hits", context->stats[context->i].get_hits);
2391-
add_assoc_long(context->entry, "get_misses", context->stats[context->i].get_misses);
2392-
add_assoc_long(context->entry, "evictions", context->stats[context->i].evictions);
2393-
add_assoc_long(context->entry, "bytes_read", context->stats[context->i].bytes_read);
2394-
add_assoc_long(context->entry, "bytes_written", context->stats[context->i].bytes_written);
2395-
add_assoc_stringl(context->entry, "version", context->stats[context->i].version, strlen(context->stats[context->i].version), 1);
2396-
2397-
add_assoc_zval_ex(context->return_value, hostport, hostport_len+1, context->entry);
2367+
MAKE_STD_ZVAL(entry);
2368+
array_init(entry);
2369+
2370+
add_assoc_long(entry, "pid", context->stats[context->i].pid);
2371+
add_assoc_long(entry, "uptime", context->stats[context->i].uptime);
2372+
add_assoc_long(entry, "threads", context->stats[context->i].threads);
2373+
add_assoc_long(entry, "time", context->stats[context->i].time);
2374+
add_assoc_long(entry, "pointer_size", context->stats[context->i].pointer_size);
2375+
add_assoc_long(entry, "rusage_user_seconds", context->stats[context->i].rusage_user_seconds);
2376+
add_assoc_long(entry, "rusage_user_microseconds", context->stats[context->i].rusage_user_microseconds);
2377+
add_assoc_long(entry, "rusage_system_seconds", context->stats[context->i].rusage_system_seconds);
2378+
add_assoc_long(entry, "rusage_system_microseconds", context->stats[context->i].rusage_system_microseconds);
2379+
add_assoc_long(entry, "curr_items", context->stats[context->i].curr_items);
2380+
add_assoc_long(entry, "total_items", context->stats[context->i].total_items);
2381+
add_assoc_long(entry, "limit_maxbytes", context->stats[context->i].limit_maxbytes);
2382+
add_assoc_long(entry, "curr_connections", context->stats[context->i].curr_connections);
2383+
add_assoc_long(entry, "total_connections", context->stats[context->i].total_connections);
2384+
add_assoc_long(entry, "connection_structures", context->stats[context->i].connection_structures);
2385+
add_assoc_long(entry, "bytes", context->stats[context->i].bytes);
2386+
add_assoc_long(entry, "cmd_get", context->stats[context->i].cmd_get);
2387+
add_assoc_long(entry, "cmd_set", context->stats[context->i].cmd_set);
2388+
add_assoc_long(entry, "get_hits", context->stats[context->i].get_hits);
2389+
add_assoc_long(entry, "get_misses", context->stats[context->i].get_misses);
2390+
add_assoc_long(entry, "evictions", context->stats[context->i].evictions);
2391+
add_assoc_long(entry, "bytes_read", context->stats[context->i].bytes_read);
2392+
add_assoc_long(entry, "bytes_written", context->stats[context->i].bytes_written);
2393+
add_assoc_stringl(entry, "version", context->stats[context->i].version, strlen(context->stats[context->i].version), 1);
2394+
2395+
add_assoc_zval_ex(context->return_value, hostport, hostport_len+1, entry);
23982396
efree(hostport);
23992397

24002398
/* Increment the server count in our context structure. Failure to do so will cause only the stats for the last server to get displayed. */

0 commit comments

Comments
 (0)