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

Commit 0ed7968

Browse files
fix comments and code style
1 parent c0d92b2 commit 0ed7968

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

‎Zend/zend_alloc.c‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3083,8 +3083,9 @@ ZEND_API void zend_mm_get_custom_handlers(zend_mm_heap *heap,
30833083

30843084
/*
30853085
* Use this function to register observers to the ZendMM.
3086-
* This function operates on the thread local heap and is meant to be called in
3087-
* RINIT. Calling it in MINIT works only in NTS builds, but not in ZTS.
3086+
* This function operates on the thread local heap and is meant to be called
3087+
* during the request lifetime. Calling it in MINIT works only in NTS builds,
3088+
* but not in ZTS.
30883089
*/
30893090
ZEND_API zend_mm_observer* zend_mm_observer_register(
30903091
zend_mm_heap* heap,
@@ -3093,9 +3094,10 @@ ZEND_API zend_mm_observer* zend_mm_observer_register(
30933094
void (*realloc)(void *, size_t, void * ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
30943095
) {
30953096
#if ZEND_MM_CUSTOM
3096-
if (!heap&& !(heap=AG(mm_heap))) {
3097-
return false;
3097+
if (!heap) {
3098+
heap=AG(mm_heap);
30983099
}
3100+
ZEND_ASSERT(heap);
30993101

31003102
zend_mm_observer *node = pemalloc(sizeof(zend_mm_observer), 1);
31013103
node->malloc = malloc;
@@ -3130,17 +3132,17 @@ ZEND_API zend_mm_observer* zend_mm_observer_register(
31303132
ZEND_API bool zend_mm_observer_unregister(zend_mm_heap *heap, zend_mm_observer *observer)
31313133
{
31323134
#if ZEND_MM_CUSTOM
3133-
if (!heap&& !(heap=AG(mm_heap))) {
3134-
return false;
3135+
if (!heap) {
3136+
heap=AG(mm_heap);
31353137
}
3138+
ZEND_ASSERT(heap);
31363139

31373140
zend_mm_observer *current = heap->observers, *prev = NULL;
31383141

31393142
if (current == observer) {
31403143
heap->observers = observer->next;
31413144
pefree(observer, 1);
3142-
if (!heap->observers)
3143-
{
3145+
if (!heap->observers) {
31443146
// this was the one and only installed observer
31453147
heap->use_custom_heap &= ~ZEND_MM_CUSTOM_HEAP_OBSERVED;
31463148
}
@@ -3153,8 +3155,9 @@ ZEND_API bool zend_mm_observer_unregister(zend_mm_heap *heap, zend_mm_observer *
31533155
}
31543156

31553157
// did not find observer or NULL was given
3156-
if (current == NULL)
3158+
if (current == NULL) {
31573159
return false;
3160+
}
31583161

31593162
prev->next = current->next;
31603163
pefree(observer, 1);
@@ -3171,9 +3174,10 @@ ZEND_API bool zend_mm_observer_unregister(zend_mm_heap *heap, zend_mm_observer *
31713174
void zend_mm_observers_shutdown(zend_mm_heap *heap)
31723175
{
31733176
#if ZEND_MM_CUSTOM
3174-
if (!heap&& !(heap=AG(mm_heap))) {
3175-
return;
3177+
if (!heap) {
3178+
heap=AG(mm_heap);
31763179
}
3180+
ZEND_ASSERT(heap);
31773181
zend_mm_observer *current = heap->observers;
31783182
zend_mm_observer *next = NULL;
31793183
while (current != NULL) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /