diff options
author | Zeev Suraski <zeev@php.net> | 1999-04-10 14:44:35 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 1999-04-10 14:44:35 +0000 |
commit | 2e9886de3c4a155c45a16e74d2e6e4b7c6d31892 (patch) | |
tree | 596cc8a4cfa2f320026fde621962ba69d10dc602 /Zend/zend_alloc.c | |
parent | e3d2234b80aac5d8defcd6fe9407ab621ba13c86 (diff) | |
download | php-git-2e9886de3c4a155c45a16e74d2e6e4b7c6d31892.tar.gz |
Get rid of php3_ini in Zend
Diffstat (limited to 'Zend/zend_alloc.c')
-rw-r--r-- | Zend/zend_alloc.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 0336982a07..eb1cc68656 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -42,11 +42,11 @@ static zend_alloc_globals alloc_globals; # endif #define _CHECK_MEMORY_LIMIT(s,file,lineno) { AG(allocated_memory) += (s);\ - if (php3_ini.memory_limit<AG(allocated_memory)) {\ + if (AG(memory_limit)<AG(allocated_memory)) {\ if (!file) { \ - zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted (tried to allocate %d bytes)",php3_ini.memory_limit,s); \ + zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted (tried to allocate %d bytes)", AG(memory_limit),s); \ } else { \ - zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)",php3_ini.memory_limit,file,lineno,s); \ + zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", AG(memory_limit), file, lineno, s); \ } \ } \ } @@ -304,11 +304,25 @@ ZEND_API char *zend_strndup(const char *s, uint length) } +ZEND_API int set_memory_limit(unsigned int memory_limit) +{ +#if MEMORY_LIMIT + ALS_FETCH(); + + AG(memory_limit) = memory_limit; + return SUCCESS; +#else + return FAILURE; +#endif +} + + ZEND_API void start_memory_manager(void) { AG(phead) = AG(head) = NULL; #if MEMORY_LIMIT + AG(memory_limit)=1<<30; /* rediculous limit, effectively no limit */ AG(allocated_memory)=0; AG(memory_exhausted)=0; #endif |