Commits

Ruslan Osmanov  committed a692c0d

Fix: check for EV_PERIODIC_ENABLE
Fix: embedding configuration

  • Participants
  • Parent commits 3fd6fe9

Comments (0)

Files changed (6)

 #include "common.h"
 #include "types.h"
 
-/* EV_STANDALONE isn't needed, since we use libev/libev.m4
- * #define EV_STANDALONE 1 */
-#undef EV_USE_POLL
-/* We compile multiple source files. So we don't need static API
- * #define EV_API_STATIC 1 */
-#undef EV_API_STATIC
-
-#define EV_COMPAT3      0
-#define EV_FEATURES     8
 #define EV_MULTIPLICITY 1
-#define EV_USE_POLL     1
-#define EV_CHILD_ENABLE 1
-#define EV_ASYNC_ENABLE 1
+#define EV_COMPAT3      0
 #define EV_MINPRI       -2
 #define EV_MAXPRI       2
 
+#undef EV_FEATURES
+/* We compile multiple source files.So we don't need static API */
+#undef EV_API_STATIC
+
 #ifdef PHP_EV_DEBUG
 # define EV_VERIFY 2
 #else
 zend_class_entry *ev_watcher_class_entry_ptr;
 zend_class_entry *ev_io_class_entry_ptr;
 zend_class_entry *ev_timer_class_entry_ptr;
+#if EV_PERIODIC_ENABLE
 zend_class_entry *ev_periodic_class_entry_ptr;
+#endif
 
 static HashTable classes;
 static HashTable php_ev_properties;
 static HashTable php_ev_watcher_properties;
 static HashTable php_ev_io_properties;
 static HashTable php_ev_timer_properties;
+#if EV_PERIODIC_ENABLE
 static HashTable php_ev_periodic_properties;
+#endif
 
 static zend_object_handlers ev_object_handlers;
 
 }
 /* }}} */
 
+#if EV_PERIODIC_ENABLE
 /* {{{ php_ev_periodic_free_storage() */
 static void php_ev_periodic_free_storage(void *object TSRMLS_DC)
 {
 	php_ev_object_free_storage(object TSRMLS_CC);
 }
 /* }}} */
+#endif
 
 /* {{{ php_ev_register_object 
  * Is called AFTER php_ev_object_new() */
 	} else if (instanceof_function(ce, ev_timer_class_entry_ptr TSRMLS_CC)) {
 		/* EvTimer */
 	 	func_free_storage = php_ev_timer_free_storage;
+#if EV_PERIODIC_ENABLE
 	} else if (instanceof_function(ce, ev_periodic_class_entry_ptr TSRMLS_CC)) {
 		/* EvPeriodic */
 	 	func_free_storage = php_ev_periodic_free_storage;
+#endif
 	} else {
 	 	func_free_storage = php_ev_object_free_storage;
 	}
 	zend_hash_add(&classes, ce->name, ce->name_length + 1, &php_ev_timer_properties, sizeof(php_ev_timer_properties), NULL);
 	/* }}} */
 
+#if EV_PERIODIC_ENABLE
 	/* {{{ EvPeriodic */
 	PHP_EV_REGISTER_CLASS_ENTRY_EX("EvPeriodic", ev_periodic_class_entry_ptr, ev_periodic_class_entry_functions, ev_watcher_class_entry_ptr);
 	ce = ev_periodic_class_entry_ptr;
 	PHP_EV_DECL_CLASS_PROPERTIES(ce, ev_periodic_property_entry_info);
 	zend_hash_add(&classes, ce->name, ce->name_length + 1, &php_ev_periodic_properties, sizeof(php_ev_periodic_properties), NULL);
 	/* }}} */
+#endif
+
 }
 /* }}} */
 
 	zend_hash_destroy(&php_ev_watcher_properties);
 	zend_hash_destroy(&php_ev_io_properties);
 	zend_hash_destroy(&php_ev_timer_properties);
+#if EV_PERIODIC_ENABLE
 	zend_hash_destroy(&php_ev_periodic_properties);
+#endif
 	zend_hash_destroy(&classes);
 
 	return SUCCESS;
 #include "loop.c" 
 #include "io.c"
 #include "timer.c"
-#include "periodic.c"
+#if EV_PERIODIC_ENABLE
+# include "periodic.c"
+#endif
 
 #endif /* HAVE_EV */
 
 ZEND_END_ARG_INFO();
 /* }}} */
 
+#if EV_PERIODIC_ENABLE
 /* {{{ EvPeriodic */
 ZEND_BEGIN_ARG_INFO_EX(arginfo_ev_periodic, 0, 0, 4)
 	ZEND_ARG_INFO(0, offset)
 	ZEND_ARG_INFO(0, interval)
 ZEND_END_ARG_INFO();
 /* }}} */
+#endif
 
 /* ARGINFO }}} */
 
 };
 /* }}} */
 
+#if EV_PERIODIC_ENABLE
 /* {{{ ev_periodic_class_entry_functions */
 const zend_function_entry ev_periodic_class_entry_functions[] = {
 	PHP_ME(EvPeriodic, __construct, arginfo_ev_periodic,       ZEND_ACC_PUBLIC  | ZEND_ACC_CTOR)
 	{ NULL, NULL, NULL }
 };
 /* }}} */
+#endif
 
 /*
  * Local variables:
 PHP_METHOD(EvTimer, again);
 /* }}} */
 
+#if EV_PERIODIC_ENABLE
 /* {{{ EvPeriodic */
 PHP_METHOD(EvPeriodic, __construct);
 PHP_METHOD(EvPeriodic, set);
 /* }}} */
+#endif
 
 #endif /* PHP_EV_FE_H */
 
 
 /* }}} */
 
+#if EV_PERIODIC_ENABLE
+/* {{{ EvPeriodic property handlers */
+
+/* }}} */
+#endif
 
 /* {{{ ev_loop_property_entries[] */
 const php_ev_property_entry ev_loop_property_entries[] = {
 };
 /* }}} */
 
+#if EV_PERIODIC_ENABLE
 /* {{{ ev_periodic_property_entries[] */
 const php_ev_property_entry ev_periodic_property_entries[] = {
     {NULL, 0, NULL, NULL}
 	{0, NULL, 0, -1, 0, NULL, 0, NULL},
 };
 /* }}} */
+#endif
 
 /*
  * Local variables:
 			break;
 #endif
 #if EV_EMBED_ENABLE
-		case EV_EMBED_ENABLE:
+		case EV_EMBED:
 			PHP_EV_WATCHER_START(ev_embed, watcher);
 			break;
 #endif
 #if EV_FORK_ENABLE
-		case EV_FORK_ENABLE:
+		case EV_FORK:
 			PHP_EV_WATCHER_START(ev_fork, watcher);
 			break;
 #endif
 			break;
 #endif
 #if EV_EMBED_ENABLE
-		case EV_EMBED_ENABLE:
+		case EV_EMBED:
 			PHP_EV_WATCHER_STOP(ev_embed, watcher);
 			break;
 #endif
 #if EV_FORK_ENABLE
-		case EV_FORK_ENABLE:
+		case EV_FORK:
 			PHP_EV_WATCHER_STOP(ev_fork, watcher);
 			break;
 #endif