summaryrefslogtreecommitdiff
path: root/ext/interbase/interbase.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2015-01-03 01:22:58 -0800
committerStanislav Malyshev <stas@php.net>2015-01-10 15:07:38 -0800
commitb7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc (patch)
tree0e09490075ee4f9a75a77ef4168d8ee254c52e5b /ext/interbase/interbase.c
parent773c8b0c092a0e9ad5c5548815bcb9991d54d5c1 (diff)
downloadphp-git-b7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc.tar.gz
trailing whitespace removal
Diffstat (limited to 'ext/interbase/interbase.c')
-rw-r--r--ext/interbase/interbase.c126
1 files changed, 63 insertions, 63 deletions
diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c
index a91bc320cf..8599bdf900 100644
--- a/ext/interbase/interbase.c
+++ b/ext/interbase/interbase.c
@@ -470,7 +470,7 @@ int le_link, le_plink, le_trans;
/* error handling ---------------------------- */
-/* {{{ proto string ibase_errmsg(void)
+/* {{{ proto string ibase_errmsg(void)
Return error message */
PHP_FUNCTION(ibase_errmsg)
{
@@ -486,7 +486,7 @@ PHP_FUNCTION(ibase_errmsg)
}
/* }}} */
-/* {{{ proto int ibase_errcode(void)
+/* {{{ proto int ibase_errcode(void)
Return error code */
PHP_FUNCTION(ibase_errcode)
{
@@ -508,7 +508,7 @@ void _php_ibase_error(void) /* {{{ */
ISC_STATUS *statusp = IB_STATUS;
IBG(sql_code) = isc_sqlcode(IB_STATUS);
-
+
while ((s - IBG(errmsg)) < MAX_ERRMSG - (IBASE_MSGSIZE + 2) && isc_interprete(s, &statusp)) {
strcat(IBG(errmsg), " ");
s = IBG(errmsg) + strlen(IBG(errmsg));
@@ -554,7 +554,7 @@ void _php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAMETERS, /* {{{ */
{
IBDEBUG("Transaction or database link?");
if (Z_RES_P(link_id)->type == le_trans) {
- /* Transaction resource: make sure it refers to one link only, then
+ /* Transaction resource: make sure it refers to one link only, then
fetch it; database link is stored in ib_trans->db_link[]. */
IBDEBUG("Type is le_trans");
ZEND_FETCH_RESOURCE(*trans, ibase_trans *, link_id, -1, LE_TRANS, le_trans);
@@ -562,16 +562,16 @@ void _php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAMETERS, /* {{{ */
_php_ibase_module_error("Link id is ambiguous: transaction spans multiple connections."
);
return;
- }
+ }
*ib_link = (*trans)->db_link[0];
return;
- }
+ }
IBDEBUG("Type is le_[p]link or id not found");
/* Database link resource, use default transaction. */
*trans = NULL;
ZEND_FETCH_RESOURCE2(*ib_link, ibase_db_link *, link_id, -1, LE_LINK, le_link, le_plink);
}
-/* }}} */
+/* }}} */
/* destructors ---------------------- */
@@ -594,7 +594,7 @@ static void _php_ibase_commit_link(ibase_db_link *link) /* {{{ */
}
efree(p->trans); /* default transaction is not a registered resource: clean up */
} else {
- if (p->trans->handle != NULL) {
+ if (p->trans->handle != NULL) {
/* non-default trans might have been rolled back by other call of this dtor */
IBDEBUG("Rolling back other transactions...");
if (isc_rollback_transaction(IB_STATUS, &p->trans->handle)) {
@@ -614,7 +614,7 @@ static void _php_ibase_commit_link(ibase_db_link *link) /* {{{ */
efree(p);
}
link->tr_list = NULL;
-
+
for (e = link->event_head; e; e = e->event_next) {
_php_ibase_free_event(e);
e->link = NULL;
@@ -664,7 +664,7 @@ static void _php_ibase_free_trans(zend_resource *rsrc) /* {{{ */
{
ibase_trans *trans = (ibase_trans *)rsrc->ptr;
unsigned short i;
-
+
IBDEBUG("Cleaning up transaction resource...");
if (trans->handle != NULL) {
IBDEBUG("Rolling back unhandled transaction...");
@@ -695,7 +695,7 @@ static void _php_ibase_free_trans(zend_resource *rsrc) /* {{{ */
static PHP_INI_DISP(php_ibase_password_displayer_cb)
{
- if ((type == PHP_INI_DISPLAY_ORIG && ini_entry->orig_value)
+ if ((type == PHP_INI_DISPLAY_ORIG && ini_entry->orig_value)
|| (type == PHP_INI_DISPLAY_ACTIVE && ini_entry->value)) {
PUTS("********");
} else if (!sapi_module.phpinfo_as_text) {
@@ -756,22 +756,22 @@ PHP_MINIT_FUNCTION(ibase)
php_ibase_blobs_minit(INIT_FUNC_ARGS_PASSTHRU);
php_ibase_events_minit(INIT_FUNC_ARGS_PASSTHRU);
php_ibase_service_minit(INIT_FUNC_ARGS_PASSTHRU);
-
- return SUCCESS;
-}
-
+
+ return SUCCESS;
+}
+
PHP_MSHUTDOWN_FUNCTION(ibase)
{
#ifndef PHP_WIN32
/**
- * When the Interbase client API library libgds.so is first loaded, it registers a call to
+ * When the Interbase client API library libgds.so is first loaded, it registers a call to
* gds__cleanup() with atexit(), in order to clean up after itself when the process exits.
* This means that the library is called at process shutdown, and cannot be unloaded beforehand.
- * PHP tries to unload modules after every request [dl()'ed modules], and right before the
+ * PHP tries to unload modules after every request [dl()'ed modules], and right before the
* process shuts down [modules loaded from php.ini]. This results in a segfault for this module.
* By NULLing the dlopen() handle in the module entry, Zend omits the call to dlclose(),
* ensuring that the module will remain present until the process exits. However, the functions
- * and classes exported by the module will not be available until the module is 'reloaded'.
+ * and classes exported by the module will not be available until the module is 'reloaded'.
* When reloaded, dlopen() will return the handle of the already loaded module. The module will
* be unloaded automatically when the process exits.
*/
@@ -793,14 +793,14 @@ PHP_RSHUTDOWN_FUNCTION(ibase)
RESET_ERRMSG;
return SUCCESS;
-}
-
+}
+
PHP_MINFO_FUNCTION(ibase)
{
char tmp[64], *s;
php_info_print_table_start();
- php_info_print_table_row(2, "Firebird/InterBase Support",
+ php_info_print_table_row(2, "Firebird/InterBase Support",
#ifdef COMPILE_DL_INTERBASE
"dynamic");
#else
@@ -832,7 +832,7 @@ PHP_MINFO_FUNCTION(ibase)
}
php_info_print_table_row(2, "Run-time Client Library Version", s);
} while (0);
-#endif
+#endif
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
@@ -841,11 +841,11 @@ PHP_MINFO_FUNCTION(ibase)
/* }}} */
enum connect_args { DB = 0, USER = 1, PASS = 2, CSET = 3, ROLE = 4, BUF = 0, DLECT = 1, SYNC = 2 };
-
-static char const dpb_args[] = {
+
+static char const dpb_args[] = {
0, isc_dpb_user_name, isc_dpb_password, isc_dpb_lc_ctype, isc_dpb_sql_role_name, 0
};
-
+
int _php_ibase_attach_db(char **args, int *len, long *largs, isc_db_handle *db)
{
short i, dpb_len, buf_len = 257-2; /* version byte at the front, and a null at the end */
@@ -861,7 +861,7 @@ int _php_ibase_attach_db(char **args, int *len, long *largs, isc_db_handle *db)
}
}
if (largs[BUF] && buf_len > 0) {
- dpb_len = slprintf(dpb, buf_len, "%c\2%c%c", isc_dpb_num_buffers,
+ dpb_len = slprintf(dpb, buf_len, "%c\2%c%c", isc_dpb_num_buffers,
(char)(largs[BUF] >> 8), (char)(largs[BUF] & 0xff));
dpb += dpb_len;
buf_len -= dpb_len;
@@ -897,9 +897,9 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /*
&largs[SYNC])) {
RETURN_FALSE;
}
-
+
/* restrict to the server/db in the .ini if in safe mode */
- if ((!len[DB] || PG(sql_safe_mode)) && (c = INI_STR("ibase.default_db"))) {
+ if ((!len[DB] || PG(sql_safe_mode)) && (c = INI_STR("ibase.default_db"))) {
args[DB] = c;
len[DB] = strlen(c);
}
@@ -915,7 +915,7 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /*
args[CSET] = c;
len[CSET] = strlen(c);
}
-
+
/* don't want usernames and passwords floating around */
PHP_MD5Init(&hash_context);
for (i = 0; i < sizeof(args)/sizeof(char*); ++i) {
@@ -925,7 +925,7 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /*
PHP_MD5Update(&hash_context,(char*)&largs[i],sizeof(long));
}
PHP_MD5Final((unsigned char*)hash, &hash_context);
-
+
/* try to reuse a connection */
if ((le = zend_hash_str_find_ptr(&EG(regular_list), hash, sizeof(hash)-1)) != NULL) {
zend_resource *xlink;
@@ -933,7 +933,7 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /*
if (le->type != le_index_ptr) {
RETURN_FALSE;
}
-
+
xlink = (zend_resource*) le->ptr;
if ((!persistent && xlink->type == le_link) || xlink->type == le_plink) {
if (IBG(default_link) > 0) {
@@ -949,7 +949,7 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /*
} else {
zend_hash_str_del(&EG(regular_list), hash, sizeof(hash)-1);
}
- }
+ }
/* ... or a persistent one */
do {
@@ -972,17 +972,17 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /*
}
/* no link found, so we have to open one */
-
+
if ((l = INI_INT("ibase.max_links")) != -1 && IBG(num_links) >= l) {
_php_ibase_module_error("Too many open links (%ld)", IBG(num_links));
RETURN_FALSE;
}
-
+
/* create the ib_link */
if (FAILURE == _php_ibase_attach_db(args, len, largs, &db_handle)) {
RETURN_FALSE;
}
-
+
/* use non-persistent if allowed number of persistent links is exceeded */
if (!persistent || ((l = INI_INT("ibase.max_persistent") != -1) && IBG(num_persistent) >= l)) {
ib_link = (ibase_db_link *) emalloc(sizeof(ibase_db_link));
@@ -1010,7 +1010,7 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /*
ib_link->dialect = largs[DLECT] ? (unsigned short)largs[DLECT] : SQL_DIALECT_CURRENT;
ib_link->tr_list = NULL;
ib_link->event_head = NULL;
-
+
++IBG(num_links);
} while (0);
@@ -1058,11 +1058,11 @@ PHP_FUNCTION(ibase_close)
int link_id;
RESET_ERRMSG;
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &link_arg) == FAILURE) {
return;
}
-
+
if (ZEND_NUM_ARGS() == 0) {
link_id = IBG(default_link);
CHECK_LINK(link_id);
@@ -1096,11 +1096,11 @@ PHP_FUNCTION(ibase_drop_db)
int link_id;
RESET_ERRMSG;
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &link_arg) == FAILURE) {
return;
}
-
+
if (ZEND_NUM_ARGS() == 0) {
link_id = IBG(default_link);
CHECK_LINK(link_id);
@@ -1108,7 +1108,7 @@ PHP_FUNCTION(ibase_drop_db)
} else {
link_id = Z_RES_P(link_arg)->handle;
}
-
+
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, LE_LINK, le_link, le_plink);
if (isc_drop_database(IB_STATUS, &ib_link->handle)) {
@@ -1144,14 +1144,14 @@ PHP_FUNCTION(ibase_trans)
ibase_trans *ib_trans;
isc_tr_handle tr_handle = NULL;
ISC_STATUS result;
-
+
RESET_ERRMSG;
argn = ZEND_NUM_ARGS();
/* (1+argn) is an upper bound for the number of links this trans connects to */
ib_link = (ibase_db_link **) safe_emalloc(sizeof(ibase_db_link *),1+argn,0);
-
+
if (argn > 0) {
long trans_argl = 0;
char *tpb;
@@ -1166,19 +1166,19 @@ PHP_FUNCTION(ibase_trans)
teb = (ISC_TEB *) safe_emalloc(sizeof(ISC_TEB),argn,0);
tpb = (char *) safe_emalloc(TPB_MAX_SIZE,argn,0);
- /* enumerate all the arguments: assume every non-resource argument
+ /* enumerate all the arguments: assume every non-resource argument
specifies modifiers for the link ids that follow it */
for (i = 0; i < argn; ++i) {
-
+
if (Z_TYPE(args[i]) == IS_RESOURCE) {
-
+
if (!ZEND_FETCH_RESOURCE2_NO_RETURN(ib_link[link_cnt], ibase_db_link *, &args[i], -1, LE_LINK, le_link, le_plink)) {
efree(teb);
efree(tpb);
efree(ib_link);
RETURN_FALSE;
}
-
+
/* copy the most recent modifier string into tbp[] */
memcpy(&tpb[TPB_MAX_SIZE * link_cnt], last_tpb, TPB_MAX_SIZE);
@@ -1186,11 +1186,11 @@ PHP_FUNCTION(ibase_trans)
teb[link_cnt].db_ptr = &ib_link[link_cnt]->handle;
teb[link_cnt].tpb_len = tpb_len;
teb[link_cnt].tpb_ptr = &tpb[TPB_MAX_SIZE * link_cnt];
-
+
++link_cnt;
-
+
} else {
-
+
tpb_len = 0;
convert_to_long_ex(&args[i]);
@@ -1212,14 +1212,14 @@ PHP_FUNCTION(ibase_trans)
if (PHP_IBASE_REC_VERSION == (trans_argl & PHP_IBASE_REC_VERSION)) {
last_tpb[tpb_len++] = isc_tpb_rec_version;
} else if (PHP_IBASE_REC_NO_VERSION == (trans_argl & PHP_IBASE_REC_NO_VERSION)) {
- last_tpb[tpb_len++] = isc_tpb_no_rec_version;
- }
+ last_tpb[tpb_len++] = isc_tpb_no_rec_version;
+ }
} else if (PHP_IBASE_CONSISTENCY == (trans_argl & PHP_IBASE_CONSISTENCY)) {
last_tpb[tpb_len++] = isc_tpb_consistency;
} else if (PHP_IBASE_CONCURRENCY == (trans_argl & PHP_IBASE_CONCURRENCY)) {
last_tpb[tpb_len++] = isc_tpb_concurrency;
}
-
+
/* lock resolution */
if (PHP_IBASE_NOWAIT == (trans_argl & PHP_IBASE_NOWAIT)) {
last_tpb[tpb_len++] = isc_tpb_nowait;
@@ -1228,8 +1228,8 @@ PHP_FUNCTION(ibase_trans)
}
}
}
- }
-
+ }
+
if (link_cnt > 0) {
result = isc_start_multiple(IB_STATUS, &tr_handle, link_cnt, teb);
}
@@ -1246,7 +1246,7 @@ PHP_FUNCTION(ibase_trans)
}
result = isc_start_transaction(IB_STATUS, &tr_handle, 1, &ib_link[0]->handle, tpb_len, last_tpb);
}
-
+
/* start the transaction */
if (result) {
_php_ibase_error();
@@ -1262,7 +1262,7 @@ PHP_FUNCTION(ibase_trans)
for (i = 0; i < link_cnt; ++i) {
ibase_tr_list **l;
ib_trans->db_link[i] = ib_link[i];
-
+
/* the first item in the connection-transaction list is reserved for the default transaction */
if (ib_link[i]->tr_list == NULL) {
ib_link[i]->tr_list = (ibase_tr_list *) emalloc(sizeof(ibase_tr_list));
@@ -1328,7 +1328,7 @@ static void _php_ibase_trans_end(INTERNAL_FUNCTION_PARAMETERS, int commit) /* {{
zval *arg = NULL;
RESET_ERRMSG;
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &arg) == FAILURE) {
return;
}
@@ -1372,7 +1372,7 @@ static void _php_ibase_trans_end(INTERNAL_FUNCTION_PARAMETERS, int commit) /* {{
result = isc_commit_retaining(IB_STATUS, &trans->handle);
break;
}
-
+
if (result) {
_php_ibase_error();
RETURN_FALSE;
@@ -1437,20 +1437,20 @@ PHP_FUNCTION(ibase_gen_id)
&inc, &link)) {
RETURN_FALSE;
}
-
+
if (gen_len > 31) {
php_error_docref(NULL, E_WARNING, "Invalid generator name");
RETURN_FALSE;
}
PHP_IBASE_LINK_TRANS(link, ib_link, trans);
-
+
snprintf(query, sizeof(query), "SELECT GEN_ID(%s,%ld) FROM rdb$database", generator, inc);
/* allocate a minimal descriptor area */
out_sqlda.sqln = out_sqlda.sqld = 1;
out_sqlda.version = SQLDA_CURRENT_VERSION;
-
+
/* allocate the field for the result */
out_sqlda.sqlvar[0].sqltype = SQL_INT64;
out_sqlda.sqlvar[0].sqlscale = 0;
@@ -1478,7 +1478,7 @@ PHP_FUNCTION(ibase_gen_id)
}
/* }}} */
-
+
#endif /* HAVE_IBASE */
/*