Commits

Ruslan Osmanov committed 0c27c95

Refact: replaced php_ev_set_watcher_priority function with corresponding marcos

  • Participants
  • Parent commits 5d13baa

Comments (0)

Files changed (3)

 		php_ev_stop_watcher(watcher TSRMLS_CC);
 	}
 
-	php_ev_set_watcher_priority(watcher, priority TSRMLS_CC);
+	php_ev_set_watcher_priority(watcher, priority);
 
 	if (active) {
 		php_ev_start_watcher(watcher TSRMLS_CC);
    +----------------------------------------------------------------------+
 */
 
-#if 0
-#include "embed.h"
-#include "priv.h"
-#include "watcher.h"
-#endif
 #include "php_ev.h"
 
 /* Defined in ev.c */
 extern zend_class_entry *ev_loop_class_entry_ptr;
 
-/* {{{ php_ev_set_watcher_priority() */
-void php_ev_set_watcher_priority(ev_watcher *watcher, long priority TSRMLS_DC)
-{
-	PHP_EV_CHECK_PENDING_WATCHER(watcher);	
-	ev_set_priority(watcher, priority);
-}
-/* }}} */
-
 /* {{{ php_ev_watcher_callback() */
 void php_ev_watcher_callback(EV_P_ ev_watcher *watcher, int revents)
 {
 
 	PHP_EV_COPY_FCALL_INFO(php_ev_watcher_fci(w), php_ev_watcher_fcc(w), pfci, pfcc);
 
-	php_ev_set_watcher_priority(w, priority TSRMLS_CC);
+	php_ev_set_watcher_priority(w, priority);
 
 	TSRMLS_SET_CTX(php_ev_watcher_thread_ctx(w));
 }
 #define PHP_EV_WATCHER_FACTORY_NS(type, zloop)                                             \
     php_ev_ ## type ## _object_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, zloop, FALSE, FALSE)
 
+#define php_ev_set_watcher_priority(watcher, priority) \
+    do {                                               \
+        PHP_EV_CHECK_PENDING_WATCHER(watcher);         \
+        ev_set_priority(watcher, priority);            \
+    } while (0);                                       \
 
 void php_ev_watcher_callback(EV_P_ ev_watcher *watcher, int revents);
 void php_ev_set_watcher(ev_watcher *w, size_t size, zval *self, php_ev_loop *loop,
 void *php_ev_new_watcher(size_t size, zval *self, php_ev_loop *loop,
 		const zend_fcall_info *pfci, const zend_fcall_info_cache *pfcc, zval *data, int priority TSRMLS_DC);
 void php_ev_stop_watcher(ev_watcher *watcher TSRMLS_DC);
-void php_ev_set_watcher_priority(ev_watcher *watcher, long priority TSRMLS_DC);
 void php_ev_start_watcher(ev_watcher *watcher TSRMLS_DC);
 
 #endif /* PHP_EV_WATCHER_H */