Skip to content

Commit 0a5b441

Browse files
committed
A few more zend_string changes
1 parent 9d9e005 commit 0a5b441

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

php_memcached.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ static void php_memc_setMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_ke
324324
static void php_memc_delete_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key);
325325
static void php_memc_deleteMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key);
326326
static void php_memc_getDelayed_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key);
327-
static memcached_return php_memc_do_cache_callback(zval *memc_obj, zend_fcall_info *fci, zend_fcall_info_cache *fcc, char *key, size_t key_len, zval *value);
327+
static memcached_return php_memc_do_cache_callback(zval *memc_obj, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string *key, zval *value);
328328
static int php_memc_do_result_callback(zval *memc_obj, zend_fcall_info *fci, zend_fcall_info_cache *fcc, memcached_result_st *result);
329329
static memcached_return php_memc_do_serverlist_callback(const memcached_st *ptr, php_memcached_instance_st instance, void *in_context);
330330
static memcached_return php_memc_do_stats_callback(const memcached_st *ptr, php_memcached_instance_st instance, void *in_context);
@@ -353,14 +353,14 @@ char *php_memc_printable_func (zend_fcall_info *fci, zend_fcall_info_cache *fci_
353353
return buffer;
354354
}
355355

356-
static zend_bool php_memcached_on_new_callback(zval *object, zend_fcall_info *fci, zend_fcall_info_cache *fci_cache, char *persistent_id, size_t persistent_id_len)
356+
static zend_bool php_memcached_on_new_callback(zval *object, zend_fcall_info *fci, zend_fcall_info_cache *fci_cache, zend_string *persistent_id)
357357
{
358358
zend_bool ret = 1;
359359
zval retval;
360360
zval params[2];
361361

362362
if (persistent_id) {
363-
ZVAL_STRINGL(&params[1], persistent_id, persistent_id_len);
363+
ZVAL_STR(&params[1], persistent_id);
364364
} else {
365365
ZVAL_NULL(&params[1]);
366366
}
@@ -479,7 +479,7 @@ static PHP_METHOD(Memcached, __construct)
479479
i_obj->is_pristine = 1;
480480

481481
if (fci.size) { /* will be 0 when not available */
482-
if (!php_memcached_on_new_callback(object, &fci, &fci_cache, persistent_id->val, persistent_id->len) || EG(exception)) {
482+
if (!php_memcached_on_new_callback(object, &fci, &fci_cache, persistent_id) || EG(exception)) {
483483
/* error calling or exception thrown from callback */
484484
if (plist_key) {
485485
zend_string_release(plist_key);
@@ -612,7 +612,7 @@ static void php_memc_get_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key)
612612
}
613613

614614
if (status == MEMCACHED_NOTFOUND && fci.size != 0) {
615-
status = php_memc_do_cache_callback(getThis(), &fci, &fcc, key->val, key->len, return_value);
615+
status = php_memc_do_cache_callback(getThis(), &fci, &fcc, key, return_value);
616616
}
617617

618618
if (php_memc_handle_error(i_obj, status) < 0) {
@@ -1869,7 +1869,6 @@ PHP_METHOD(Memcached, incrementByKey)
18691869
PHP_METHOD(Memcached, addServer)
18701870
{
18711871
zend_string *host;
1872-
int host_len;
18731872
long port, weight = 0;
18741873
memcached_return status;
18751874
MEMC_METHOD_INIT_VARS;
@@ -3498,8 +3497,7 @@ zend_class_entry *php_memc_get_exception_base(int root)
34983497
}
34993498

35003499
static memcached_return php_memc_do_cache_callback(zval *zmemc_obj, zend_fcall_info *fci,
3501-
zend_fcall_info_cache *fcc, char *key,
3502-
size_t key_len, zval *value)
3500+
zend_fcall_info_cache *fcc, zend_string *key, zval *value)
35033501
{
35043502
char *payload = NULL;
35053503
size_t payload_len = 0;
@@ -3514,7 +3512,7 @@ static memcached_return php_memc_do_cache_callback(zval *zmemc_obj, zend_fcall_i
35143512
memcached_return status = MEMCACHED_SUCCESS;
35153513
int result;
35163514

3517-
ZVAL_STRINGL(&z_key, key, key_len);
3515+
ZVAL_STR(&z_key, key);
35183516
ZVAL_NULL(value);
35193517
ZVAL_LONG(&z_expiration, 0);
35203518

@@ -3545,7 +3543,7 @@ static memcached_return php_memc_do_cache_callback(zval *zmemc_obj, zend_fcall_i
35453543
if (payload == NULL) {
35463544
status = (memcached_return)MEMC_RES_PAYLOAD_FAILURE;
35473545
} else {
3548-
rc = memcached_set(m_obj->memc, key, key_len, payload, payload_len, expiration, flags);
3546+
rc = memcached_set(m_obj->memc, key->val, key->len, payload, payload_len, expiration, flags);
35493547
if (rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED) {
35503548
status = rc;
35513549
}
@@ -3660,13 +3658,12 @@ PHP_METHOD(MemcachedServer, run)
36603658
{
36613659
int i;
36623660
zend_bool rc;
3663-
char *address;
3664-
int address_len;
3661+
zend *address;
36653662

36663663
php_memc_server_t *intern;
36673664
intern = Z_MEMC_OBJ_P(getThis());
36683665

3669-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &address, &address_len) == FAILURE) {
3666+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &address) == FAILURE) {
36703667
return;
36713668
}
36723669

php_memcached_server.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,10 +779,10 @@ evutil_socket_t s_create_listening_socket (const char *spec)
779779
return sock;
780780
}
781781

782-
zend_bool php_memc_proto_handler_run (php_memc_proto_handler_t *handler, const char *address)
782+
zend_bool php_memc_proto_handler_run (php_memc_proto_handler_t *handler, zend_string *address)
783783
{
784784
struct event *accept_event;
785-
evutil_socket_t sock = s_create_listening_socket (address);
785+
evutil_socket_t sock = s_create_listening_socket (address->val);
786786

787787
if (sock == -1) {
788788
return 0;

php_memcached_server.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ php_memc_proto_handler_t *php_memc_proto_handler_new ();
3333

3434
void php_memc_proto_handler_destroy (php_memc_proto_handler_t **ptr);
3535

36-
zend_bool php_memc_proto_handler_run (php_memc_proto_handler_t *h, const char *address);
36+
zend_bool php_memc_proto_handler_run (php_memc_proto_handler_t *h, zend_string *address);
3737

3838
#endif
3939

40-
#endif
40+
#endif

0 commit comments

Comments
 (0)