Skip to content

Zend headers #14552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Zend/zend_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2881,7 +2881,7 @@ ZEND_API char* ZEND_FASTCALL zend_strndup(const char *s, size_t length)
return p;
}

ZEND_API zend_result zend_set_memory_limit(size_t memory_limit)
ZEND_API bool zend_set_memory_limit(size_t memory_limit)
{
#if ZEND_MM_LIMIT
zend_mm_heap *heap = AG(mm_heap);
Expand All @@ -2896,13 +2896,13 @@ ZEND_API zend_result zend_set_memory_limit(size_t memory_limit)
heap->cached_chunks_count--;
heap->real_size -= ZEND_MM_CHUNK_SIZE;
} while (memory_limit < heap->real_size);
return SUCCESS;
return true;
}
return FAILURE;
return false;
}
AG(mm_heap)->limit = memory_limit;
#endif
return SUCCESS;
return true;
}

ZEND_API bool zend_alloc_in_memory_limit_error_reporting(void)
Expand Down
6 changes: 2 additions & 4 deletions Zend/zend_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
#ifndef ZEND_ALLOC_H
#define ZEND_ALLOC_H

#include <stdio.h>

#include "zend_types.h"
#include "zend_portability.h"
#include "../TSRM/TSRM.h"

#ifndef ZEND_MM_ALIGNMENT
Expand Down Expand Up @@ -215,7 +213,7 @@ ZEND_API ZEND_ATTRIBUTE_MALLOC char * __zend_strdup(const char *s);
#define perealloc2_recoverable_rel(ptr, size, copy_size, persistent) ((persistent)?realloc((ptr), (size)):erealloc2_recoverable_rel((ptr), (size), (copy_size)))
#define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s))

ZEND_API zend_result zend_set_memory_limit(size_t memory_limit);
ZEND_API bool zend_set_memory_limit(size_t memory_limit);
ZEND_API bool zend_alloc_in_memory_limit_error_reporting(void);

ZEND_API void start_memory_manager(void);
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef _ZEND_ARENA_H_
#define _ZEND_ARENA_H_

#include "zend.h"
#include "zend_alloc.h"

#ifndef ZEND_TRACK_ARENA_ALLOC

Expand Down
2 changes: 0 additions & 2 deletions Zend/zend_call_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#ifndef ZEND_CALL_STACK_H
#define ZEND_CALL_STACK_H

#include "zend.h"
#include "zend_portability.h"
#ifdef __APPLE__
# include <pthread.h>
#endif
Expand Down
6 changes: 2 additions & 4 deletions Zend/zend_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@
#include "zend_llist.h"
#include "zend_objects.h"
#include "zend_objects_API.h"
#include "zend_modules.h"
#include "zend_float.h"
#include "zend_multibyte.h"
#include "zend_multiply.h"
#include "zend_arena.h"
#include "zend_call_stack.h"
#include "zend_max_execution_timer.h"
#include "zend_strtod.h"
#include "zend_compile.h"
#include "zend_ini.h"

/* Define ZTS if you want a thread-safe Zend */
/*#undef ZTS*/
Expand All @@ -64,13 +65,10 @@ END_EXTERN_C()
# define ZEND_MAX_ALLOWED_STACK_SIZE_DETECT 0
#endif

#include "zend_compile.h"

/* excpt.h on Digital Unix 4.0 defines function_table */
#undef function_table

typedef struct _zend_vm_stack *zend_vm_stack;
typedef struct _zend_ini_entry zend_ini_entry;
typedef struct _zend_fiber_context zend_fiber_context;
typedef struct _zend_fiber zend_fiber;

Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
*/

#include "zend.h"
#include "zend_sort.h"
#include "zend_API.h"
#include "zend_ini.h"
#include "zend_alloc.h"
#include "zend_globals.h"
#include "zend_globals_macros.h"
#include "zend_operators.h"
#include "zend_strtod.h"
#include "zend_modules.h"
Expand Down
7 changes: 6 additions & 1 deletion Zend/zend_ini.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
#ifndef ZEND_INI_H
#define ZEND_INI_H

#include "zend_modules.h"
#include "zend_portability.h"
#include "zend_types.h"
#include "zend_stream.h"

#define ZEND_INI_USER (1<<0)
#define ZEND_INI_PERDIR (1<<1)
Expand All @@ -30,6 +32,9 @@
#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, zend_string *new_value, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage)
#define ZEND_INI_DISP(name) ZEND_COLD void name(zend_ini_entry *ini_entry, int type)

typedef struct _zend_module_entry zend_module_entry;
typedef struct _zend_ini_entry zend_ini_entry;

typedef struct _zend_ini_entry_def {
const char *name;
ZEND_INI_MH((*on_modify));
Expand Down
3 changes: 1 addition & 2 deletions Zend/zend_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@

/* resource lists */

#include "zend.h"
#include "zend_list.h"
#include "zend.h"
#include "zend_API.h"
#include "zend_globals.h"

ZEND_API int le_index_ptr;

Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#ifndef ZEND_LIST_H
#define ZEND_LIST_H

#include "zend_hash.h"
#include "zend_globals.h"
#include "zend_portability.h"
#include "zend_types.h"

BEGIN_EXTERN_C()

Expand Down
3 changes: 2 additions & 1 deletion Zend/zend_llist.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
+----------------------------------------------------------------------+
*/

#include "zend.h"
#include "zend_llist.h"
#include "zend_alloc.h"
#include "zend_sort.h"
#include <string.h>

ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent)
{
Expand Down
2 changes: 2 additions & 0 deletions Zend/zend_llist.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#ifndef ZEND_LLIST_H
#define ZEND_LLIST_H

#include <stdarg.h>
#include <stddef.h>
#include "zend_portability.h"

typedef struct _zend_llist_element {
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
#ifndef MODULES_H
#define MODULES_H

#include "zend.h"
#include "zend_compile.h"
#include "zend_portability.h"
#include "zend_types.h"
#include "zend_build.h"
#include "zend_ini.h"

#define INIT_FUNC_ARGS int type, int module_number
#define INIT_FUNC_ARGS_PASSTHRU type, module_number
Expand Down Expand Up @@ -64,7 +65,6 @@
#define MODULE_PERSISTENT 1
#define MODULE_TEMPORARY 2

struct _zend_ini_entry;
typedef struct _zend_module_entry zend_module_entry;
typedef struct _zend_module_dep zend_module_dep;

Expand Down
1 change: 1 addition & 0 deletions Zend/zend_multiply.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include "zend_portability.h"
#include "zend.h" /* For zend_error_noreturn() */

#ifndef ZEND_MULTIPLY_H
#define ZEND_MULTIPLY_H
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#ifndef ZEND_OBSERVER_H
#define ZEND_OBSERVER_H

#include "zend.h"
#include "zend_compile.h"
#include "zend_portability.h" /* For ZEND_FASTCALL */
#include "zend_types.h"
#include "zend_fibers.h"

BEGIN_EXTERN_C()
Expand Down
1 change: 0 additions & 1 deletion Zend/zend_operators.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include <ctype.h>

#include "zend.h"
#include "zend_operators.h"
#include "zend_variables.h"
#include "zend_globals.h"
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#endif

#include "zend_portability.h"
#include "zend_strtod.h"
#include "zend_multiply.h"
#include "zend_hash.h"
#include "zend_string.h"
#include "zend_object_handlers.h"

#define LONG_SIGN_MASK ZEND_LONG_MIN
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_ptr_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
+----------------------------------------------------------------------+
*/

#include "zend.h"
#include "zend_ptr_stack.h"
#include "zend_alloc.h"
#include <stdarg.h>

ZEND_API void zend_ptr_stack_init_ex(zend_ptr_stack *stack, bool persistent)
Expand Down
1 change: 1 addition & 0 deletions Zend/zend_ptr_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#ifndef ZEND_PTR_STACK_H
#define ZEND_PTR_STACK_H

#include "zend_portability.h"
#include "zend_alloc.h"

typedef struct _zend_ptr_stack {
Expand Down
1 change: 0 additions & 1 deletion Zend/zend_smart_str.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
+----------------------------------------------------------------------+
*/

#include <zend.h>
#include "zend_smart_str.h"
#include "zend_smart_string.h"
#include "zend_enum.h"
Expand Down
6 changes: 4 additions & 2 deletions Zend/zend_smart_str.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
#ifndef ZEND_SMART_STR_H
#define ZEND_SMART_STR_H

#include <zend.h>
#include "zend_globals.h"
#include "zend_smart_str_public.h"
#include "zend_portability.h"
#include "zend_long.h"
#include "zend_string.h"
#include "zend_operators.h"

BEGIN_EXTERN_C()

Expand Down
3 changes: 2 additions & 1 deletion Zend/zend_smart_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
#include "zend_smart_string_public.h"

#include <stdlib.h>
#include <zend.h>
#include "zend_portability.h"
#include "zend_long.h"

/* wrapper */

Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_smart_string_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef PHP_SMART_STRING_PUBLIC_H
#define PHP_SMART_STRING_PUBLIC_H

#include <sys/types.h>
#include <stddef.h>

typedef struct {
char *c;
Expand Down
5 changes: 3 additions & 2 deletions Zend/zend_sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
+----------------------------------------------------------------------+
*/

#include "zend.h"
#include "zend_sort.h"
#include <limits.h>
#include "zend_long.h"
#include "zend_portability.h"
#include <stddef.h>

static inline void zend_sort_2(void *a, void *b, compare_func_t cmp, swap_func_t swp) /* {{{ */ {
if (cmp(a, b) > 0) {
Expand Down
1 change: 1 addition & 0 deletions Zend/zend_sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#ifndef ZEND_SORT_H
#define ZEND_SORT_H

#include "zend_portability.h"
#include "zend_types.h"

BEGIN_EXTERN_C()
Expand Down
3 changes: 2 additions & 1 deletion Zend/zend_strtod.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
* can be found in zend_strtod.c */
#ifndef ZEND_STRTOD_H
#define ZEND_STRTOD_H
#include <zend.h>

#include "zend_portability.h"

BEGIN_EXTERN_C()
#define ZEND_STRTOD_K_MAX 7
Expand Down
1 change: 1 addition & 0 deletions ext/mbstring/libmbfl/filters/mbfilter_base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include "mbfilter.h"
#include "mbfilter_base64.h"
#include "zend_multiply.h" /* For zend_safe_address_guarded() */

static size_t mb_base64_to_wchar(unsigned char **in, size_t *in_len, uint32_t *buf, size_t bufsize, unsigned int *state);
static void mb_wchar_to_base64(uint32_t *in, size_t len, mb_convert_buf *buf, bool end);
Expand Down
5 changes: 4 additions & 1 deletion ext/opcache/ZendAccelerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
# include <config.h>
#endif


#define ACCELERATOR_PRODUCT_NAME "Zend OPcache"
/* 2 - added Profiler support, on 20010712 */
/* 3 - added support for Optimizer's encoded-only-files mode */
Expand All @@ -48,6 +49,8 @@
# include "unistd.h"
#endif

#include "zend_types.h"
#include "zend_modules.h"
#include "zend_extensions.h"
#include "zend_compile.h"

Expand Down Expand Up @@ -311,7 +314,7 @@ extern const char *zps_api_failure_reason;
BEGIN_EXTERN_C()

void accel_shutdown(void);
zend_result accel_activate(INIT_FUNC_ARGS);
zend_result accel_activate(INIT_FUNC_ARGS);
zend_result accel_post_deactivate(void);
void zend_accel_schedule_restart(zend_accel_restart_reason reason);
void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason);
Expand Down
2 changes: 1 addition & 1 deletion main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ static PHP_INI_MH(OnChangeMemoryLimit)
} else {
value = Z_L(1)<<30; /* effectively, no limit */
}
if (zend_set_memory_limit(value) == FAILURE) {
if (!zend_set_memory_limit(value)) {
/* When the memory limit is reset to the original level during deactivation, we may be
* using more memory than the original limit while shutdown is still in progress.
* Ignore a failure for now, and set the memory limit when the memory manager has been
Expand Down
Loading