LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
fi
-AC_CHECK_LIB(nsl, gethostname, [
- LIBS="-lnsl $LIBS"
- AC_DEFINE(HAVE_LIBNSL) ], [])
-
AC_CHECK_LIB(c, socket, [:], [
AC_CHECK_LIB(socket, socket, [
LIBS="-lsocket $LIBS"
AC_DEFINE(HAVE_LIBSOCKET) ], []) ])
-AC_CHECK_LIB(c, gethostbyaddr, [:], [
- AC_CHECK_LIB(nsl, gethostbyaddr, [
- LIBS="-lnsl $LIBS"
- AC_DEFINE(HAVE_LIBNSL) ], []) ])
-
AC_CHECK_LIB(c, dlopen, [
# fake it
AC_DEFINE(HAVE_LIBDL) ], [
AC_CHECK_LIB(c, sin, [:], [
AC_CHECK_LIB(m, sin) ])
-dnl The res_search may be in libsocket as well, and if it is
-dnl make sure to check for dn_skipname in libresolv, or if res_search
-dnl is in neither of these libs, still check for dn_skipname in libresolv
-AC_CHECK_LIB(socket, res_search, [
- AC_CHECK_LIB(resolv, dn_skipname)
- AC_CHECK_LIB(resolv, __dn_skipname)
- LIBS="$LIBS -lsocket"
- AC_DEFINE(HAVE_LIBSOCKET)
-], [
- AC_CHECK_LIB(resolv, res_search, [
- LIBS="$LIBS -lresolv"
- AC_DEFINE(HAVE_LIBRESOLV)
- ], [
- AC_CHECK_LIB(resolv, dn_skipname)
- AC_CHECK_LIB(resolv, __dn_skipname)
- ])
-])
-
dnl Checks for header files.
AC_HEADER_STDC
}
file_handle.filename = filename->value.str.val;
file_handle.type = ZEND_HANDLE_FILENAME;
- retval = compile_files(0 CLS_CC, 1, &file_handle);
+ retval = zend_compile_files(0 CLS_CC, 1, &file_handle);
if (filename==&tmp) {
zval_dtor(&tmp);
}
standard_class.handle_function_call = NULL;
standard_class.handle_property_get = NULL;
standard_class.handle_property_set = NULL;
+ standard_class.refcount = (int *) malloc(sizeof(int));
+ *standard_class.refcount = 1;
zend_hash_add(CG(class_table), "stdClass", sizeof("stdClass"), &standard_class, sizeof(zend_class_entry), NULL);
}
free(CG(function_table));
zend_hash_destroy(CG(class_table));
free(CG(class_table));
- zend_llist_destroy(&zend_extensions);
+ zend_shutdown_extensions();
free(zend_version_info);
zend_shutdown_constants();
}
char *fname;
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
unsigned char *func_arg_types;
-} function_entry;
+} zend_function_entry;
typedef struct {
char *name;
uint name_length;
struct _zend_class_entry *parent;
+ int *refcount;
HashTable function_table;
HashTable default_properties;
/* registers all functions in *library_functions in the function hash */
-int register_functions(function_entry *functions)
+int register_functions(zend_function_entry *functions)
{
- function_entry *ptr = functions;
+ zend_function_entry *ptr = functions;
zend_internal_function internal_function;
int count=0,unload=0;
CLS_FETCH();
/* count=-1 means erase all functions, otherwise,
* erase the first count functions
*/
-void unregister_functions(function_entry *functions,int count)
+void unregister_functions(zend_function_entry *functions,int count)
{
- function_entry *ptr = functions;
+ zend_function_entry *ptr = functions;
int i=0;
CLS_FETCH();
class_entry->type = ZEND_INTERNAL_CLASS;
class_entry->parent = NULL;
+ class_entry->refcount = (int *) malloc(sizeof(int));
+ *class_entry->refcount = 1;
zend_hash_init(&class_entry->default_properties, 0, NULL, PVAL_PTR_DTOR, 1);
zend_hash_init(&class_entry->function_table, 0, NULL, (void (*)(void *)) destroy_zend_function, 1);
#include "zend_list.h"
+#define ZEND_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
+#define ZEND_FUNCTION(name) ZEND_NAMED_FUNCTION(zend_if_##name)
+
+#define ZEND_NAMED_FE(runtime_name, name, arg_types) { #runtime_name, name, arg_types },
+#define ZEND_FE(name, arg_types) ZEND_NAMED_FE(name, zend_if_##name, arg_types)
+
+
int zend_next_free_module(void);
int getParameters(int ht, int param_count,...);
int ParameterPassedByReference(int ht, uint n);
-int register_functions(function_entry *functions);
-void unregister_functions(function_entry *functions, int count);
+int register_functions(zend_function_entry *functions);
+void unregister_functions(zend_function_entry *functions, int count);
int register_module(zend_module_entry *module_entry);
zend_class_entry *register_internal_class(zend_class_entry *class_entry);
_mem_block_check(ptr, 1, filename, lineno);
#endif
+ HANDLE_BLOCK_INTERRUPTIONS();
+
/* remove the block from the non persistent list */
REMOVE_POINTER_FROM_LIST(p);
/* add the block to the persistent list */
ADD_POINTER_TO_LIST(p);
+ HANDLE_UNBLOCK_INTERRUPTIONS();
}
CG(class_entry).type = ZEND_USER_CLASS;
CG(class_entry).name = class_name->u.constant.value.str.val;
CG(class_entry).name_length = class_name->u.constant.value.str.len;
+ CG(class_entry).refcount = (int *) emalloc(sizeof(int));
+ *CG(class_entry).refcount = 1;
zend_str_tolower(CG(class_entry).name, CG(class_entry).name_length);
#endif
}
-
-void zend_extension_dtor(zend_extension *extension)
+static void zend_extension_shutdown(zend_extension *extension)
{
#if ZEND_EXTENSIONS_SUPPORT
if (extension->shutdown) {
extension->shutdown(extension);
}
+#endif
+}
+
+
+void zend_shutdown_extensions()
+{
+ zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_shutdown);
+ zend_llist_destroy(&zend_extensions);
+}
+
+
+void zend_extension_dtor(zend_extension *extension)
+{
+#if ZEND_EXTENSIONS_SUPPORT
DL_UNLOAD(extension->handle);
#endif
}
int zend_load_extension(char *path);
int zend_load_extensions(char **extension_paths);
void zend_append_version_info(zend_extension *extension);
+void zend_shutdown_extensions();
#endif /* _ZEND_EXTENSIONS_H */
zend_ptr_stack argument_stack;
+ void *reserved[4];
#if SUPPORT_INTERACTIVE
int interactive;
#endif
ZEND_API void zend_llist_destroy(zend_llist *l)
{
- zend_llist_element *current=l->head, *next;
+ zend_llist_element *current, *next;
- while (current) {
- next = current->next;
- if (l->dtor) {
+ if (l->dtor) {
+ current = l->head;
+
+ while (current) {
l->dtor(current->data);
+ current = current->next;
}
+ }
+
+ current = l->head;
+ while (current) {
+ next = current->next;
pefree(current, l->persistent);
current = next;
}
}
+
ZEND_API void zend_llist_remove_tail(zend_llist *l)
{
zend_llist_element *old_tail;
typedef struct {
char *name;
- function_entry *functions;
+ zend_function_entry *functions;
int (*module_startup_func)(INIT_FUNC_ARGS);
int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS);
int (*request_startup_func)(INIT_FUNC_ARGS);
ZEND_API void destroy_zend_class(zend_class_entry *ce)
{
+ if (--(*ce->refcount)>0) {
+ return;
+ }
switch (ce->type) {
case ZEND_USER_CLASS:
efree(ce->name);