Skip to content

Commit 9e3551b

Browse files
committed
Eliminated the TSRMLS_FETCH() in zend_set_memory_limit()
1 parent f046189 commit 9e3551b

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

UPGRADING.INTERNALS

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ UPGRADE NOTES - PHP X.Y
1717
1. Internal API changes
1818
========================
1919

20+
a. zend_set_memory_limit() now takes the TSRMLS_CC macro as its last argument
21+
2022

2123
========================
2224
2. Build system changes

Zend/zend_alloc.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -2682,10 +2682,8 @@ ZEND_API char *zend_strndup(const char *s, uint length)
26822682
}
26832683

26842684

2685-
ZEND_API int zend_set_memory_limit(size_t memory_limit)
2685+
ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC)
26862686
{
2687-
TSRMLS_FETCH();
2688-
26892687
AG(mm_heap)->limit = (memory_limit >= AG(mm_heap)->block_size) ? memory_limit : AG(mm_heap)->block_size;
26902688

26912689
return SUCCESS;

Zend/zend_alloc.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ inline static void * __zend_realloc(void *p, size_t len)
139139
#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):STR_EMPTY_ALLOC())
140140
#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):STR_EMPTY_ALLOC())
141141

142-
ZEND_API int zend_set_memory_limit(size_t memory_limit);
142+
ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC);
143143

144144
ZEND_API void start_memory_manager(TSRMLS_D);
145145
ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC);

main/main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static PHP_INI_MH(OnChangeMemoryLimit)
179179
} else {
180180
PG(memory_limit) = 1<<30; /* effectively, no limit */
181181
}
182-
return zend_set_memory_limit(PG(memory_limit));
182+
return zend_set_memory_limit(PG(memory_limit) TSRMLS_CC);
183183
}
184184
/* }}} */
185185

@@ -1166,7 +1166,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
11661166
CG(parse_error) = 0;
11671167
} else {
11681168
/* restore memory limit */
1169-
zend_set_memory_limit(PG(memory_limit));
1169+
zend_set_memory_limit(PG(memory_limit) TSRMLS_CC);
11701170
efree(buffer);
11711171
zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC);
11721172
zend_bailout();

0 commit comments

Comments
 (0)