From a5470139f5305341fca92f942852d1ae18b254ea Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Thu, 23 Oct 2014 10:16:16 +0200 Subject: [PATCH] Fix MacOSX/clang --- package.xml | 4 +--- php_pq.h | 11 ++++++----- src/php_pq_callback.h | 10 +++++----- src/php_pq_misc.h | 18 +++++++++--------- src/php_pq_object.h | 18 +++++++++--------- src/php_pq_params.h | 15 +++++++-------- src/php_pqcancel.h | 8 ++++---- src/php_pqconn.h | 24 ++++++++++++------------ src/php_pqconn_event.h | 8 ++++---- src/php_pqcopy.h | 8 ++++---- src/php_pqcur.h | 10 +++++----- src/php_pqexc.h | 6 +++--- src/php_pqlob.h | 8 ++++---- src/php_pqres.h | 16 ++++++++-------- src/php_pqstm.h | 8 ++++---- src/php_pqtxn.c | 2 +- src/php_pqtxn.h | 10 +++++----- src/php_pqtypes.h | 8 ++++---- 18 files changed, 95 insertions(+), 97 deletions(-) diff --git a/package.xml b/package.xml index fabd855..8a741ab 100644 --- a/package.xml +++ b/package.xml @@ -33,7 +33,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> 2014-10-23 - 0.5.3 + 0.5.4dev 0.5.0 @@ -42,8 +42,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> BSD, revised diff --git a/php_pq.h b/php_pq.h index 1d406ff..b4583e9 100644 --- a/php_pq.h +++ b/php_pq.h @@ -14,11 +14,7 @@ #ifndef PHP_PQ_H #define PHP_PQ_H -#define PHP_PQ_VERSION "0.5.3" - -int pq_module_number; -zend_module_entry pq_module_entry; -#define phpext_pq_ptr &pq_module_entry +#define PHP_PQ_VERSION "0.5.4dev" #ifdef PHP_WIN32 # define PHP_PQ_API __declspec(dllexport) @@ -28,6 +24,11 @@ zend_module_entry pq_module_entry; # define PHP_PQ_API extern #endif +extern int pq_module_number; +extern zend_module_entry pq_module_entry; +#define phpext_pq_ptr &pq_module_entry + + #ifdef ZTS # include "TSRM.h" # define TSRMLS_DF(d) TSRMLS_D = (d)->ts diff --git a/src/php_pq_callback.h b/src/php_pq_callback.h index 3b0d48e..2edf6d5 100644 --- a/src/php_pq_callback.h +++ b/src/php_pq_callback.h @@ -21,11 +21,11 @@ typedef struct php_pq_callback { struct php_pq_callback *recursion; } php_pq_callback_t; -void php_pq_callback_dtor(php_pq_callback_t *cb); -void php_pq_callback_addref(php_pq_callback_t *cb); -zval *php_pq_callback_to_zval(php_pq_callback_t *cb); -zend_bool php_pq_callback_is_locked(php_pq_callback_t *cb TSRMLS_DC); -void php_pq_callback_recurse(php_pq_callback_t *old, php_pq_callback_t *new TSRMLS_DC); +extern void php_pq_callback_dtor(php_pq_callback_t *cb); +extern void php_pq_callback_addref(php_pq_callback_t *cb); +extern zval *php_pq_callback_to_zval(php_pq_callback_t *cb); +extern zend_bool php_pq_callback_is_locked(php_pq_callback_t *cb TSRMLS_DC); +extern void php_pq_callback_recurse(php_pq_callback_t *old, php_pq_callback_t *new TSRMLS_DC); #endif diff --git a/src/php_pq_misc.h b/src/php_pq_misc.h index 6ca2f31..7c42319 100644 --- a/src/php_pq_misc.h +++ b/src/php_pq_misc.h @@ -28,27 +28,27 @@ typedef int STATUS; /* SUCCESS/FAILURE */ #endif /* trim LF from EOL */ -char *php_pq_rtrim(char *e); +extern char *php_pq_rtrim(char *e); /* R, W, RW */ -const char *php_pq_strmode(long mode); +extern const char *php_pq_strmode(long mode); /* compare array index */ -int php_pq_compare_index(const void *lptr, const void *rptr TSRMLS_DC); +extern int php_pq_compare_index(const void *lptr, const void *rptr TSRMLS_DC); #define PHP_PQerrorMessage(c) php_pq_rtrim(PQerrorMessage((c))) #define PHP_PQresultErrorMessage(r) php_pq_rtrim(PQresultErrorMessage((r))) -zend_class_entry *php_pqdt_class_entry; -zval *php_pqdt_from_string(char *datetime_str, size_t datetime_len, char *fmt, zval *zv TSRMLS_DC); -void php_pqdt_to_string(zval *zdt, const char *format, char **str_buf, size_t *str_len TSRMLS_DC); +extern zend_class_entry *php_pqdt_class_entry; +extern zval *php_pqdt_from_string(char *datetime_str, size_t datetime_len, char *fmt, zval *zv TSRMLS_DC); +extern void php_pqdt_to_string(zval *zdt, const char *format, char **str_buf, size_t *str_len TSRMLS_DC); -zend_class_entry *php_pqconv_class_entry; +extern zend_class_entry *php_pqconv_class_entry; -HashTable *php_pq_parse_array(php_pqres_t *res, const char *val_str, size_t val_len, Oid typ TSRMLS_DC); +extern HashTable *php_pq_parse_array(php_pqres_t *res, const char *val_str, size_t val_len, Oid typ TSRMLS_DC); -PHP_MINIT_FUNCTION(pq_misc); +extern PHP_MINIT_FUNCTION(pq_misc); #endif diff --git a/src/php_pq_object.h b/src/php_pq_object.h index 311f17f..d26fb7b 100644 --- a/src/php_pq_object.h +++ b/src/php_pq_object.h @@ -27,15 +27,15 @@ typedef struct php_pq_object_prophandler { php_pq_object_prophandler_func_t write; } php_pq_object_prophandler_t; -void php_pq_object_to_zval(void *o, zval **zv TSRMLS_DC); -void php_pq_object_to_zval_no_addref(void *o, zval **zv TSRMLS_DC); -void php_pq_object_addref(void *o TSRMLS_DC); -void php_pq_object_delref(void *o TSRMLS_DC); -HashTable *php_pq_object_debug_info(zval *object, int *temp TSRMLS_DC); -HashTable *php_pq_object_properties(zval *object TSRMLS_DC); -zend_class_entry *ancestor(zend_class_entry *ce); -zval *php_pq_object_read_prop(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC); -void php_pq_object_write_prop(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC); +extern void php_pq_object_to_zval(void *o, zval **zv TSRMLS_DC); +extern void php_pq_object_to_zval_no_addref(void *o, zval **zv TSRMLS_DC); +extern void php_pq_object_addref(void *o TSRMLS_DC); +extern void php_pq_object_delref(void *o TSRMLS_DC); +extern HashTable *php_pq_object_debug_info(zval *object, int *temp TSRMLS_DC); +extern HashTable *php_pq_object_properties(zval *object TSRMLS_DC); +extern zend_class_entry *ancestor(zend_class_entry *ce); +extern zval *php_pq_object_read_prop(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC); +extern void php_pq_object_write_prop(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC); #endif diff --git a/src/php_pq_params.h b/src/php_pq_params.h index 00fbad8..fe5d9c6 100644 --- a/src/php_pq_params.h +++ b/src/php_pq_params.h @@ -29,14 +29,13 @@ typedef struct php_pq_params { #endif } php_pq_params_t; -php_pq_params_t *php_pq_params_init(HashTable *conv, HashTable *oids, HashTable *params TSRMLS_DC); -void php_pq_params_free(php_pq_params_t **p); -unsigned php_pq_params_set_params(php_pq_params_t *p, HashTable *params); -unsigned php_pq_params_set_type_oids(php_pq_params_t *p, HashTable *oids); -unsigned php_pq_params_add_type_oid(php_pq_params_t *p, Oid type); -unsigned php_pq_params_add_param(php_pq_params_t *p, zval *param); -void php_pq_params_set_type_conv(php_pq_params_t *p, HashTable *conv); - +extern php_pq_params_t *php_pq_params_init(HashTable *conv, HashTable *oids, HashTable *params TSRMLS_DC); +extern void php_pq_params_free(php_pq_params_t **p); +extern unsigned php_pq_params_set_params(php_pq_params_t *p, HashTable *params); +extern unsigned php_pq_params_set_type_oids(php_pq_params_t *p, HashTable *oids); +extern unsigned php_pq_params_add_type_oid(php_pq_params_t *p, Oid type); +extern unsigned php_pq_params_add_param(php_pq_params_t *p, zval *param); +extern void php_pq_params_set_type_conv(php_pq_params_t *p, HashTable *conv); #endif diff --git a/src/php_pqcancel.h b/src/php_pqcancel.h index 2f2d185..ad9fb64 100644 --- a/src/php_pqcancel.h +++ b/src/php_pqcancel.h @@ -28,11 +28,11 @@ typedef struct php_pqcancel_object { php_pqcancel_t *intern; } php_pqcancel_object_t; -zend_class_entry *php_pqcancel_class_entry; -zend_object_value php_pqcancel_create_object_ex(zend_class_entry *ce, php_pqcancel_t *intern, php_pqcancel_object_t **ptr TSRMLS_DC); +extern zend_class_entry *php_pqcancel_class_entry; +extern zend_object_value php_pqcancel_create_object_ex(zend_class_entry *ce, php_pqcancel_t *intern, php_pqcancel_object_t **ptr TSRMLS_DC); -PHP_MINIT_FUNCTION(pqcancel); -PHP_MSHUTDOWN_FUNCTION(pqcancel); +extern PHP_MINIT_FUNCTION(pqcancel); +extern PHP_MSHUTDOWN_FUNCTION(pqcancel); #endif diff --git a/src/php_pqconn.h b/src/php_pqconn.h index 4f4b56c..940f214 100644 --- a/src/php_pqconn.h +++ b/src/php_pqconn.h @@ -49,20 +49,20 @@ typedef struct php_pqconn_resource_factory_data { long flags; } php_pqconn_resource_factory_data_t; -php_resource_factory_ops_t *php_pqconn_get_resource_factory_ops(void); +extern php_resource_factory_ops_t *php_pqconn_get_resource_factory_ops(void); -zend_class_entry *php_pqconn_class_entry; -zend_object_value php_pqconn_create_object_ex(zend_class_entry *ce, php_pqconn_t *intern, php_pqconn_object_t **ptr TSRMLS_DC); -void php_pqconn_notify_listeners(php_pqconn_object_t *obj TSRMLS_DC); -STATUS php_pqconn_prepare(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params TSRMLS_DC); -STATUS php_pqconn_prepare_async(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params TSRMLS_DC); -STATUS php_pqconn_start_transaction(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable TSRMLS_DC); -STATUS php_pqconn_start_transaction_async(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable TSRMLS_DC); -STATUS php_pqconn_declare(zval *object, php_pqconn_object_t *obj, const char *decl TSRMLS_DC); -STATUS php_pqconn_declare_async(zval *object, php_pqconn_object_t *obj, const char *decl TSRMLS_DC); +extern zend_class_entry *php_pqconn_class_entry; +extern zend_object_value php_pqconn_create_object_ex(zend_class_entry *ce, php_pqconn_t *intern, php_pqconn_object_t **ptr TSRMLS_DC); +extern void php_pqconn_notify_listeners(php_pqconn_object_t *obj TSRMLS_DC); +extern STATUS php_pqconn_prepare(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params TSRMLS_DC); +extern STATUS php_pqconn_prepare_async(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params TSRMLS_DC); +extern STATUS php_pqconn_start_transaction(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable TSRMLS_DC); +extern STATUS php_pqconn_start_transaction_async(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable TSRMLS_DC); +extern STATUS php_pqconn_declare(zval *object, php_pqconn_object_t *obj, const char *decl TSRMLS_DC); +extern STATUS php_pqconn_declare_async(zval *object, php_pqconn_object_t *obj, const char *decl TSRMLS_DC); -PHP_MINIT_FUNCTION(pqconn); -PHP_MSHUTDOWN_FUNCTION(pqconn); +extern PHP_MINIT_FUNCTION(pqconn); +extern PHP_MSHUTDOWN_FUNCTION(pqconn); #endif diff --git a/src/php_pqconn_event.h b/src/php_pqconn_event.h index 85aeab4..df4afca 100644 --- a/src/php_pqconn_event.h +++ b/src/php_pqconn_event.h @@ -25,10 +25,10 @@ typedef struct php_pqconn_event_data { #endif } php_pqconn_event_data_t; -php_pqconn_event_data_t *php_pqconn_event_data_init(php_pqconn_object_t *obj TSRMLS_DC); -void php_pqconn_notice_recv(void *p, const PGresult *res); -void php_pqconn_notice_ignore(void *p, const PGresult *res); -int php_pqconn_event(PGEventId id, void *e, void *data); +extern php_pqconn_event_data_t *php_pqconn_event_data_init(php_pqconn_object_t *obj TSRMLS_DC); +extern void php_pqconn_notice_recv(void *p, const PGresult *res); +extern void php_pqconn_notice_ignore(void *p, const PGresult *res); +extern int php_pqconn_event(PGEventId id, void *e, void *data); #endif diff --git a/src/php_pqcopy.h b/src/php_pqcopy.h index 03bdd5b..130a1f2 100644 --- a/src/php_pqcopy.h +++ b/src/php_pqcopy.h @@ -41,11 +41,11 @@ typedef struct php_pqcopy_object { php_pqcopy_t *intern; } php_pqcopy_object_t; -zend_class_entry *php_pqcopy_class_entry; -zend_object_value php_pqcopy_create_object_ex(zend_class_entry *ce, php_pqcopy_t *intern, php_pqcopy_object_t **ptr TSRMLS_DC); +extern zend_class_entry *php_pqcopy_class_entry; +extern zend_object_value php_pqcopy_create_object_ex(zend_class_entry *ce, php_pqcopy_t *intern, php_pqcopy_object_t **ptr TSRMLS_DC); -PHP_MINIT_FUNCTION(pqcopy); -PHP_MSHUTDOWN_FUNCTION(pqcopy); +extern PHP_MINIT_FUNCTION(pqcopy); +extern PHP_MSHUTDOWN_FUNCTION(pqcopy); #endif diff --git a/src/php_pqcur.h b/src/php_pqcur.h index cc142e8..be44607 100644 --- a/src/php_pqcur.h +++ b/src/php_pqcur.h @@ -36,13 +36,13 @@ typedef struct php_pqcur_object { php_pqcur_t *intern; } php_pqcur_object_t; -zend_class_entry *php_pqcur_class_entry; -zend_object_value php_pqcur_create_object_ex(zend_class_entry *ce, php_pqcur_t *intern, php_pqcur_object_t **ptr TSRMLS_DC); +extern zend_class_entry *php_pqcur_class_entry; +extern zend_object_value php_pqcur_create_object_ex(zend_class_entry *ce, php_pqcur_t *intern, php_pqcur_object_t **ptr TSRMLS_DC); -char *php_pqcur_declare_str(const char *name_str, size_t name_len, unsigned flags, const char *query_str, size_t query_len); +extern char *php_pqcur_declare_str(const char *name_str, size_t name_len, unsigned flags, const char *query_str, size_t query_len); -PHP_MINIT_FUNCTION(pqcur); -PHP_MSHUTDOWN_FUNCTION(pqcur); +extern PHP_MINIT_FUNCTION(pqcur); +extern PHP_MSHUTDOWN_FUNCTION(pqcur); #endif diff --git a/src/php_pqexc.h b/src/php_pqexc.h index 0c522ae..c5847da 100644 --- a/src/php_pqexc.h +++ b/src/php_pqexc.h @@ -26,10 +26,10 @@ typedef enum php_pqexc_type { EX_SQL } php_pqexc_type_t; -zend_class_entry *exce(php_pqexc_type_t type); -zval *throw_exce(php_pqexc_type_t type TSRMLS_DC, const char *fmt, ...); +extern zend_class_entry *exce(php_pqexc_type_t type); +extern zval *throw_exce(php_pqexc_type_t type TSRMLS_DC, const char *fmt, ...); -PHP_MINIT_FUNCTION(pqexc); +extern PHP_MINIT_FUNCTION(pqexc); #endif diff --git a/src/php_pqlob.h b/src/php_pqlob.h index 2d43718..98c8a94 100644 --- a/src/php_pqlob.h +++ b/src/php_pqlob.h @@ -30,11 +30,11 @@ typedef struct php_pqlob_object { php_pqlob_t *intern; } php_pqlob_object_t; -zend_class_entry *php_pqlob_class_entry; -zend_object_value php_pqlob_create_object_ex(zend_class_entry *ce, php_pqlob_t *intern, php_pqlob_object_t **ptr TSRMLS_DC); +extern zend_class_entry *php_pqlob_class_entry; +extern zend_object_value php_pqlob_create_object_ex(zend_class_entry *ce, php_pqlob_t *intern, php_pqlob_object_t **ptr TSRMLS_DC); -PHP_MINIT_FUNCTION(pqlob); -PHP_MSHUTDOWN_FUNCTION(pqlob); +extern PHP_MINIT_FUNCTION(pqlob); +extern PHP_MSHUTDOWN_FUNCTION(pqlob); #endif diff --git a/src/php_pqres.h b/src/php_pqres.h index d2d35d4..6298aa1 100644 --- a/src/php_pqres.h +++ b/src/php_pqres.h @@ -54,10 +54,10 @@ typedef struct php_pqres_object { php_pqres_t *intern; } php_pqres_object_t; -STATUS php_pqres_success(PGresult *res TSRMLS_DC); -void php_pqres_init_instance_data(PGresult *res, php_pqconn_object_t *obj, php_pqres_object_t **ptr TSRMLS_DC); -zval *php_pqres_row_to_zval(PGresult *res, unsigned row, php_pqres_fetch_t fetch_type, zval **data_ptr TSRMLS_DC); -zval *php_pqres_typed_zval(php_pqres_t *res, char *val, size_t len, Oid typ TSRMLS_DC); +extern STATUS php_pqres_success(PGresult *res TSRMLS_DC); +extern void php_pqres_init_instance_data(PGresult *res, php_pqconn_object_t *obj, php_pqres_object_t **ptr TSRMLS_DC); +extern zval *php_pqres_row_to_zval(PGresult *res, unsigned row, php_pqres_fetch_t fetch_type, zval **data_ptr TSRMLS_DC); +extern zval *php_pqres_typed_zval(php_pqres_t *res, char *val, size_t len, Oid typ TSRMLS_DC); #include "php_pq_object.h" #include "php_pqconn_event.h" @@ -70,11 +70,11 @@ zval *php_pqres_typed_zval(php_pqres_t *res, char *val, size_t len, Oid typ TSRM } \ } while(0) -zend_class_entry *php_pqres_class_entry; -zend_object_value php_pqres_create_object_ex(zend_class_entry *ce, php_pqres_t *intern, php_pqres_object_t **ptr TSRMLS_DC); +extern zend_class_entry *php_pqres_class_entry; +extern zend_object_value php_pqres_create_object_ex(zend_class_entry *ce, php_pqres_t *intern, php_pqres_object_t **ptr TSRMLS_DC); -PHP_MINIT_FUNCTION(pqres); -PHP_MSHUTDOWN_FUNCTION(pqres); +extern PHP_MINIT_FUNCTION(pqres); +extern PHP_MSHUTDOWN_FUNCTION(pqres); #endif diff --git a/src/php_pqstm.h b/src/php_pqstm.h index e40420c..07d0f08 100644 --- a/src/php_pqstm.h +++ b/src/php_pqstm.h @@ -30,11 +30,11 @@ typedef struct php_pqstm_object { php_pqstm_t *intern; } php_pqstm_object_t; -zend_class_entry *php_pqstm_class_entry; -zend_object_value php_pqstm_create_object_ex(zend_class_entry *ce, php_pqstm_t *intern, php_pqstm_object_t **ptr TSRMLS_DC); +extern zend_class_entry *php_pqstm_class_entry; +extern zend_object_value php_pqstm_create_object_ex(zend_class_entry *ce, php_pqstm_t *intern, php_pqstm_object_t **ptr TSRMLS_DC); -PHP_MINIT_FUNCTION(pqstm); -PHP_MSHUTDOWN_FUNCTION(pqstm); +extern PHP_MINIT_FUNCTION(pqstm); +extern PHP_MSHUTDOWN_FUNCTION(pqstm); #endif diff --git a/src/php_pqtxn.c b/src/php_pqtxn.c index c3b0acc..0f5c4eb 100644 --- a/src/php_pqtxn.c +++ b/src/php_pqtxn.c @@ -32,7 +32,7 @@ zend_class_entry *php_pqtxn_class_entry; static zend_object_handlers php_pqtxn_object_handlers; static HashTable php_pqtxn_object_prophandlers; -const char *isolation_level(long *isolation) +const char *php_pq_isolation_level(long *isolation) { switch (*isolation) { case PHP_PQTXN_SERIALIZABLE: diff --git a/src/php_pqtxn.h b/src/php_pqtxn.h index 4ca8c95..920e570 100644 --- a/src/php_pqtxn.h +++ b/src/php_pqtxn.h @@ -38,13 +38,13 @@ typedef struct php_pqtxn_object { php_pqtxn_t *intern; } php_pqtxn_object_t; -const char *isolation_level(long *isolation); +extern const char *isolation_level(long *isolation); -zend_class_entry *php_pqtxn_class_entry; -zend_object_value php_pqtxn_create_object_ex(zend_class_entry *ce, php_pqtxn_t *intern, php_pqtxn_object_t **ptr TSRMLS_DC); +extern zend_class_entry *php_pqtxn_class_entry; +extern zend_object_value php_pqtxn_create_object_ex(zend_class_entry *ce, php_pqtxn_t *intern, php_pqtxn_object_t **ptr TSRMLS_DC); -PHP_MINIT_FUNCTION(pqtxn); -PHP_MSHUTDOWN_FUNCTION(pqtxn); +extern PHP_MINIT_FUNCTION(pqtxn); +extern PHP_MSHUTDOWN_FUNCTION(pqtxn); #endif diff --git a/src/php_pqtypes.h b/src/php_pqtypes.h index 0686e5d..8a551b1 100644 --- a/src/php_pqtypes.h +++ b/src/php_pqtypes.h @@ -28,11 +28,11 @@ typedef struct php_pqtypes_object { php_pqtypes_t *intern; } php_pqtypes_object_t; -zend_class_entry *php_pqtypes_class_entry; -zend_object_value php_pqtypes_create_object_ex(zend_class_entry *ce, php_pqtypes_t *intern, php_pqtypes_object_t **ptr TSRMLS_DC); +extern zend_class_entry *php_pqtypes_class_entry; +extern zend_object_value php_pqtypes_create_object_ex(zend_class_entry *ce, php_pqtypes_t *intern, php_pqtypes_object_t **ptr TSRMLS_DC); -PHP_MINIT_FUNCTION(pqtypes); -PHP_MSHUTDOWN_FUNCTION(pqtypes); +extern PHP_MINIT_FUNCTION(pqtypes); +extern PHP_MSHUTDOWN_FUNCTION(pqtypes); #endif -- 2.30.2