Skip to content

Commit 52a1489

Browse files
committed
Fix build warnings
just to make gcc happy 1/ variable « memc_user_data » set but not used [-Wunused-but-set-variable] (void)memc_user_data only to avoid the warning (removed later by optimizer) 2/ « status » may be used uninitialized in this function [-Wmaybe-uninitialized] 3/ pointer targets in passing argument 2 of « smart_str_appendl_ex » differ in signedness [-Wpointer-sign]
1 parent 466485a commit 52a1489

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: php_memcached.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ static inline php_memc_object_t *php_memc_fetch_object(zend_object *obj) {
194194
php_error_docref(NULL, E_WARNING, "Memcached constructor was not called"); \
195195
return; \
196196
} \
197-
memc_user_data = (php_memc_user_data_t *) memcached_get_user_data(intern->memc);
197+
memc_user_data = (php_memc_user_data_t *) memcached_get_user_data(intern->memc); \
198+
(void)memc_user_data; /* avoid unused variable warning */
198199

199200
static
200201
zend_bool s_memc_valid_key_binary(const char *key)
@@ -898,7 +899,7 @@ zend_bool s_serialize_value (php_memc_serializer_type serializer, zval *value, s
898899
php_error_docref(NULL, E_WARNING, "could not serialize value with igbinary");
899900
return 0;
900901
}
901-
smart_str_appendl (buf, buffer, buffer_len);
902+
smart_str_appendl (buf, (char *)buffer, buffer_len);
902903
efree(buffer);
903904
MEMC_VAL_SET_TYPE(*flags, MEMC_VAL_IS_IGBINARY);
904905
}
@@ -1058,7 +1059,7 @@ zend_bool s_memc_write_zval (php_memc_object_t *intern, php_memc_write_op op, ze
10581059
{
10591060
uint32_t flags = 0;
10601061
zend_string *payload = NULL;
1061-
memcached_return status;
1062+
memcached_return status = 0;
10621063
php_memc_user_data_t *memc_user_data = memcached_get_user_data(intern->memc);
10631064
zend_long retries = memc_user_data->store_retry_count;
10641065

0 commit comments

Comments
 (0)