split source
[m6w6/ext-pq] / src / php_pq_callback.c
diff --git a/src/php_pq_callback.c b/src/php_pq_callback.c
new file mode 100644 (file)
index 0000000..1f02a45
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+    +--------------------------------------------------------------------+
+    | PECL :: pq                                                         |
+    +--------------------------------------------------------------------+
+    | Redistribution and use in source and binary forms, with or without |
+    | modification, are permitted provided that the conditions mentioned |
+    | in the accompanying LICENSE file are met.                          |
+    +--------------------------------------------------------------------+
+    | Copyright (c) 2013, Michael Wallner <mike@php.net>                 |
+    +--------------------------------------------------------------------+
+*/
+
+#ifdef HAVE_CONFIG_H
+#      include "config.h"
+#endif
+
+#include <php.h>
+
+#include "php_pq_callback.h"
+
+void php_pq_callback_dtor(php_pq_callback_t *cb)
+{
+       if (cb->fci.size > 0) {
+               zend_fcall_info_args_clear(&cb->fci, 1);
+               zval_ptr_dtor(&cb->fci.function_name);
+               if (cb->fci.object_ptr) {
+                       zval_ptr_dtor(&cb->fci.object_ptr);
+               }
+       }
+       cb->fci.size = 0;
+}
+
+void php_pq_callback_addref(php_pq_callback_t *cb)
+{
+       Z_ADDREF_P(cb->fci.function_name);
+       if (cb->fci.object_ptr) {
+               Z_ADDREF_P(cb->fci.object_ptr);
+       }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */