Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit542fc30

Browse files
committed
free_reply_callbacks
1 parent65e5798 commit542fc30

File tree

2 files changed

+31
-34
lines changed

2 files changed

+31
-34
lines changed

‎common.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,4 @@ typedef struct {
658658
}redis_object;
659659
#endif
660660

661-
void
662-
free_reply_callbacks(zval*z_this,RedisSock*redis_sock);
663-
664661
#endif

‎redis.c

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,30 @@ static int send_discard_static(RedisSock *redis_sock TSRMLS_DC) {
424424
returnresult;
425425
}
426426

427+
staticvoid
428+
free_reply_callbacks(RedisSock*redis_sock)
429+
{
430+
fold_item*fi;
431+
request_item*ri;
432+
433+
for (fi=redis_sock->head;fi; ) {
434+
fold_item*fi_next=fi->next;
435+
free(fi);
436+
fi=fi_next;
437+
}
438+
redis_sock->head=NULL;
439+
redis_sock->current=NULL;
440+
441+
for (ri=redis_sock->pipeline_head;ri; ) {
442+
structrequest_item*ri_next=ri->next;
443+
free(ri->request_str);
444+
free(ri);
445+
ri=ri_next;
446+
}
447+
redis_sock->pipeline_head=NULL;
448+
redis_sock->pipeline_current=NULL;
449+
}
450+
427451
#if (PHP_MAJOR_VERSION<7)
428452
void
429453
free_redis_object(void*objectTSRMLS_DC)
@@ -750,7 +774,7 @@ PHP_METHOD(Redis,__destruct) {
750774
// Discard any multi commands, and free any callbacks that have been
751775
// queued
752776
send_discard_static(redis_sockTSRMLS_CC);
753-
free_reply_callbacks(getThis(),redis_sock);
777+
free_reply_callbacks(redis_sock);
754778
}
755779
}
756780

@@ -2266,7 +2290,7 @@ PHP_METHOD(Redis, multi)
22662290
RETURN_FALSE;
22672291
}
22682292
IF_PIPELINE() {
2269-
free_reply_callbacks(getThis(),redis_sock);
2293+
free_reply_callbacks(redis_sock);
22702294
RETURN_ZVAL(getThis(),1,0);
22712295
}
22722296
}
@@ -2300,7 +2324,7 @@ redis_sock_read_multibulk_pipeline_reply(INTERNAL_FUNCTION_PARAMETERS,
23002324
redis_sock,return_value,0);
23012325

23022326
/* free allocated function/request memory */
2303-
free_reply_callbacks(getThis(),redis_sock);
2327+
free_reply_callbacks(redis_sock);
23042328

23052329
return0;
23062330

@@ -2336,30 +2360,6 @@ PHP_REDIS_API int redis_sock_read_multibulk_multi_reply(INTERNAL_FUNCTION_PARAME
23362360
return0;
23372361
}
23382362

2339-
void
2340-
free_reply_callbacks(zval*z_this,RedisSock*redis_sock) {
2341-
2342-
fold_item*fi;
2343-
fold_item*head=redis_sock->head;
2344-
request_item*ri;
2345-
2346-
for(fi=head;fi; ) {
2347-
fold_item*fi_next=fi->next;
2348-
free(fi);
2349-
fi=fi_next;
2350-
}
2351-
redis_sock->head=NULL;
2352-
redis_sock->current=NULL;
2353-
2354-
for(ri=redis_sock->pipeline_head;ri; ) {
2355-
structrequest_item*ri_next=ri->next;
2356-
free(ri->request_str);
2357-
free(ri);
2358-
ri=ri_next;
2359-
}
2360-
redis_sock->pipeline_head=NULL;
2361-
redis_sock->pipeline_current=NULL;
2362-
}
23632363

23642364
/* exec */
23652365
PHP_METHOD(Redis,exec)
@@ -2387,12 +2387,12 @@ PHP_METHOD(Redis, exec)
23872387
redis_sock)<0)
23882388
{
23892389
zval_dtor(return_value);
2390-
free_reply_callbacks(object,redis_sock);
2390+
free_reply_callbacks(redis_sock);
23912391
redis_sock->mode=ATOMIC;
23922392
redis_sock->watching=0;
23932393
RETURN_FALSE;
23942394
}
2395-
free_reply_callbacks(object,redis_sock);
2395+
free_reply_callbacks(redis_sock);
23962396
redis_sock->mode=ATOMIC;
23972397
redis_sock->watching=0;
23982398
}
@@ -2426,7 +2426,7 @@ PHP_METHOD(Redis, exec)
24262426
array_init(return_value);
24272427
}
24282428
redis_sock->mode=ATOMIC;
2429-
free_reply_callbacks(object,redis_sock);
2429+
free_reply_callbacks(redis_sock);
24302430
}
24312431
}
24322432

@@ -2478,7 +2478,7 @@ PHP_METHOD(Redis, pipeline)
24782478
/* NB : we keep the function fold, to detect the last function.
24792479
* We need the response format of the n - 1 command. So, we can delete
24802480
* when n > 2, the { 1 .. n - 2} commands */
2481-
free_reply_callbacks(getThis(),redis_sock);
2481+
free_reply_callbacks(redis_sock);
24822482
}
24832483
RETURN_ZVAL(getThis(),1,0);
24842484
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp