+----------------------------------------------------------------------+
*/
-/* $Id: php_yaz.c,v 1.115 2008/02/20 10:08:15 dickmeiss Exp $ */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define MAX_ASSOC 200
+#define GET_PARM1(a) zend_parse_parameters(1 , "z", a)
+#define GET_PARM2(a,b) zend_parse_parameters(2, "zz", a, b)
+#define GET_PARM3(a,b,c) zend_parse_parameters(3, "zzz", a, b, c)
+#define GET_PARM4(a,b,c,d) zend_parse_parameters(4, "zzzz", a, b, c, d)
+
typedef struct Yaz_AssociationInfo *Yaz_Association;
struct Yaz_AssociationInfo {
static Yaz_Association yaz_association_mk()
{
- Yaz_Association p = xmalloc (sizeof(*p));
+ Yaz_Association p = xmalloc(sizeof(*p));
- p->zoom_conn = ZOOM_connection_create (0);
+ p->zoom_conn = ZOOM_connection_create(0);
p->zoom_set = 0;
p->zoom_scan = 0;
p->zoom_package = 0;
return p;
}
-static void yaz_association_destroy (Yaz_Association p)
+static void yaz_association_destroy(Yaz_Association p)
{
if (!p) {
return;
*assocp = 0;
#ifdef ZTS
- tsrm_mutex_lock (yaz_mutex);
+ tsrm_mutex_lock(yaz_mutex);
#endif
ZEND_FETCH_RESOURCE(as, Yaz_Association *, &id, -1, "YAZ link", le_link);
*assocp = *as;
} else {
#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
+ tsrm_mutex_unlock(yaz_mutex);
#endif
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid YAZ handle");
}
if (as) {
char s[30];
- sprintf (s, "%d", v);
+ sprintf(s, "%d", v);
ZOOM_connection_option_set(as->zoom_conn, name, s);
}
}
otherInfo[0] = otherInfo[1] = otherInfo[2] = 0;
if (ZEND_NUM_ARGS() == 1) {
- if (zend_parse_parameters(1, "z", &zurl)
- == FAILURE) {
+ if (GET_PARM1(&zurl) == FAILURE) {
WRONG_PARAM_COUNT;
}
} else if (ZEND_NUM_ARGS() == 2) {
- if (zend_parse_parameters(2, "zz", &zurl, &user)
- == FAILURE) {
+ if (GET_PARM2(&zurl, &user) == FAILURE) {
WRONG_PARAM_COUNT;
}
if (i == -1) {
char msg[80];
#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
+ tsrm_mutex_unlock(yaz_mutex);
#endif
sprintf(msg, "No YAZ handles available. max_links=%d",
max_links);
yaz_association_destroy(shared_associations[i]);
}
}
- shared_associations[i] = as = yaz_association_mk ();
+ shared_associations[i] = as = yaz_association_mk();
option_set(as, "proxy", proxy_str);
option_set(as, "sru", sru_str);
as->zoom_set = 0;
}
#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
+ tsrm_mutex_unlock(yaz_mutex);
#endif
ZEND_REGISTER_RESOURCE(return_value, &shared_associations[i], le_link);
if (ZEND_NUM_ARGS() != 1) {
WRONG_PARAM_COUNT;
}
- if (zend_parse_parameters(1, "z", &id) == FAILURE) {
+ if (GET_PARM1(&id) == FAILURE) {
RETURN_FALSE;
}
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
Yaz_Association p;
if (ZEND_NUM_ARGS() == 3) {
- if (zend_parse_parameters(3, "zzz", &id, &type, &query)
- == FAILURE) {
+ if (GET_PARM3(&id, &type, &query) == FAILURE) {
WRONG_PARAM_COUNT;
}
} else {
if (p->sort_criteria) {
ZOOM_query_sortby(q, p->sort_criteria);
}
- xfree (p->sort_criteria);
+ xfree(p->sort_criteria);
p->sort_criteria = 0;
p->zoom_set = ZOOM_connection_search(p->zoom_conn, q);
RETVAL_TRUE;
if (ZEND_NUM_ARGS() != 1) {
WRONG_PARAM_COUNT;
}
- if (zend_parse_parameters(1, "z", id) == FAILURE) {
+ if (GET_PARM1(id) == FAILURE) {
WRONG_PARAM_COUNT;
}
long *val = 0;
long *event_bool = 0;
HashTable *options_ht = 0;
- if (zend_parse_parameters(1, "z", &pval_options) == FAILURE) {
+ if (GET_PARM1(&pval_options) == FAILURE) {
WRONG_PARAM_COUNT;
}
if (Z_TYPE_PP(&pval_options) != IS_ARRAY) {
}
if (no) {
- while (ZOOM_event (no, conn_ar))
+ while (ZOOM_event(no, conn_ar))
;
}
RETURN_TRUE;
pval *id;
Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_parse_parameters(1, "z", &id) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || GET_PARM1(&id) == FAILURE) {
WRONG_PARAM_COUNT;
}
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
pval *id;
Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_parse_parameters(1, "z", &id) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || GET_PARM1(&id) == FAILURE) {
WRONG_PARAM_COUNT;
}
pval *id;
Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_parse_parameters(ZEND_NUM_ARGS(), "z", &id) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || GET_PARM1(&id) == FAILURE) {
WRONG_PARAM_COUNT;
}
Yaz_Association p;
if (ZEND_NUM_ARGS() == 1) {
- if (zend_parse_parameters(1, "z", &id) == FAILURE) {
+ if (GET_PARM1(&id) == FAILURE) {
WRONG_PARAM_COUNT;
}
} else if (ZEND_NUM_ARGS() == 2) {
- if (zend_parse_parameters(2, "zz", &id, &searchresult) == FAILURE) {
+ if (GET_PARM2(&id, &searchresult) == FAILURE) {
WRONG_PARAM_COUNT;
}
if (array_init(searchresult) == FAILURE) {
int length_starting;
int length_implementation;
int max_elements = 256;
- Z_GenericRecord *r = odr_malloc (o, sizeof(*r));
- r->elements = odr_malloc (o, sizeof(*r->elements) * max_elements);
+ Z_GenericRecord *r = odr_malloc(o, sizeof(*r));
+ r->elements = odr_malloc(o, sizeof(*r->elements) * max_elements);
r->num_elements = 0;
record_length = atoi_n(buf, 5);
tag->tagOccurrence = 0;
tag->metaData = 0;
tag->appliedVariant = 0;
- tag->tagValue = odr_malloc (o, sizeof(*tag->tagValue));
+ tag->tagValue = odr_malloc(o, sizeof(*tag->tagValue));
tag->tagValue->which = Z_StringOrNumeric_string;
tag->tagValue->u.string = odr_strdup(o, "leader");
tag->tagOccurrence = 0;
tag->metaData = 0;
tag->appliedVariant = 0;
- tag->tagValue = odr_malloc (o, sizeof(*tag->tagValue));
+ tag->tagValue = odr_malloc(o, sizeof(*tag->tagValue));
tag->tagValue->which = Z_StringOrNumeric_string;
tag->tagValue->u.string = odr_strdup(o, tag_str);
if (buf[i + indicator_length] != ISO2709_IDFS) {
identifier_flag = 0;
}
- } else if (!memcmp (tag_str, "00", 2)) {
+ } else if (!memcmp(tag_str, "00", 2)) {
identifier_flag = 0;
}
int i0;
/* prepare tag */
Z_TaggedElement *parent_tag = tag;
- Z_TaggedElement *tag = odr_malloc (o, sizeof(*tag));
+ Z_TaggedElement *tag = odr_malloc(o, sizeof(*tag));
if (parent_tag->content->u.subtree->num_elements < 256) {
parent_tag->content->u.subtree->elements[
tag->tagOccurrence = 0;
tag->metaData = 0;
tag->appliedVariant = 0;
- tag->tagValue = odr_malloc (o, sizeof(*tag->tagValue));
+ tag->tagValue = odr_malloc(o, sizeof(*tag->tagValue));
tag->tagValue->which = Z_StringOrNumeric_string;
/* sub field */
if (ZEND_NUM_ARGS() != 3) {
WRONG_PARAM_COUNT;
}
- if (zend_parse_parameters(3, "zzz", &pval_id, &pval_pos, &pval_type)
- == FAILURE) {
+ if (GET_PARM3( &pval_id, &pval_pos, &pval_type) == FAILURE) {
WRONG_PARAM_COUNT;
}
}
}
}
- release_assoc (p);
+ release_assoc(p);
}
/* }}} */
Yaz_Association p;
if (ZEND_NUM_ARGS() != 2 ||
- zend_parse_parameters(2, "zz", &pval_id, &pval_syntax) == FAILURE) {
+ GET_PARM2(&pval_id, &pval_syntax) == FAILURE) {
WRONG_PARAM_COUNT;
}
Yaz_Association p;
if (ZEND_NUM_ARGS() != 2 ||
- zend_parse_parameters(2, "zz", &pval_id, &pval_element) == FAILURE) {
+ GET_PARM2(&pval_id, &pval_element) == FAILURE) {
WRONG_PARAM_COUNT;
}
Yaz_Association p;
if (ZEND_NUM_ARGS() != 2 ||
- zend_parse_parameters(2, "zz", &pval_id, &pval_element) == FAILURE) {
+ GET_PARM2(&pval_id, &pval_element) == FAILURE) {
WRONG_PARAM_COUNT;
}
Yaz_Association p;
if (ZEND_NUM_ARGS() == 2) {
- if (zend_parse_parameters(2, "zz", &pval_id, &pval_ar) == FAILURE) {
+ if (GET_PARM2(&pval_id, &pval_ar) == FAILURE) {
WRONG_PARAM_COUNT;
}
if (Z_TYPE_PP(&pval_ar) != IS_ARRAY) {
}
option_set(p, key, (*ent)->value.str.val);
}
- release_assoc (p);
+ release_assoc(p);
}
} else if (ZEND_NUM_ARGS() == 3) {
- if (zend_parse_parameters(3, "zzz", &pval_id, &pval_name, &pval_val)
- == FAILURE) {
+ if (GET_PARM3( &pval_id, &pval_name, &pval_val) == FAILURE) {
WRONG_PARAM_COUNT;
}
get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
if (ZEND_NUM_ARGS() != 2) {
WRONG_PARAM_COUNT;
}
- if (zend_parse_parameters(2, "zz", &pval_id, &pval_name) == FAILURE) {
+ if (GET_PARM2(&pval_id, &pval_name) == FAILURE) {
WRONG_PARAM_COUNT;
}
Yaz_Association p;
if (ZEND_NUM_ARGS() != 3 ||
- zend_parse_parameters(3, "zzz", &pval_id, &pval_start, &pval_number)
- == FAILURE) {
+ GET_PARM3( &pval_id, &pval_start, &pval_number) == FAILURE) {
WRONG_PARAM_COUNT;
}
Yaz_Association p;
if (ZEND_NUM_ARGS() != 2 ||
- zend_parse_parameters(2, "zz", &pval_id, &pval_criteria) == FAILURE) {
+ GET_PARM2(&pval_id, &pval_criteria) == FAILURE) {
WRONG_PARAM_COUNT;
}
}
/* }}} */
-const char *ill_array_lookup (void *handle, const char *name)
+const char *ill_array_lookup(void *handle, const char *name)
{
return array_lookup_string((HashTable *) handle, name);
}
Yaz_Association p;
if (ZEND_NUM_ARGS() != 2 ||
- zend_parse_parameters(2, "zz", &pval_id, &pval_package) == FAILURE) {
+ GET_PARM2(&pval_id, &pval_package) == FAILURE) {
WRONG_PARAM_COUNT;
}
if (Z_TYPE_PP(&pval_package) != IS_ARRAY) {
p->zoom_package = ZOOM_connection_package(p->zoom_conn, options);
ZOOM_package_send(p->zoom_package, "itemorder");
ZOOM_options_set_callback(options, 0, 0);
- ZOOM_options_destroy (options);
+ ZOOM_options_destroy(options);
}
release_assoc(p);
}
Yaz_Association p;
if (ZEND_NUM_ARGS() != 3 ||
- zend_parse_parameters(3, "zzz", &pval_id, &pval_type,
- &pval_package) == FAILURE) {
+ GET_PARM3( &pval_id, &pval_type, &pval_package) == FAILURE) {
WRONG_PARAM_COUNT;
}
if (Z_TYPE_PP(&pval_type) != IS_STRING) {
p->zoom_package = ZOOM_connection_package(p->zoom_conn, options);
ZOOM_package_send(p->zoom_package, pval_type->value.str.val);
ZOOM_options_set_callback(options, 0, 0);
- ZOOM_options_destroy (options);
+ ZOOM_options_destroy(options);
}
release_assoc(p);
}
Yaz_Association p;
if (ZEND_NUM_ARGS() == 3) {
- if (zend_parse_parameters(3, "zzz", &pval_id, &pval_type, &pval_query)
- == FAILURE) {
+ if (GET_PARM3( &pval_id, &pval_type, &pval_query) == FAILURE) {
WRONG_PARAM_COUNT;
}
} else if (ZEND_NUM_ARGS() == 4) {
- if (zend_parse_parameters(4, "zzzz", &pval_id, &pval_type,
- &pval_query, &pval_flags) == FAILURE) {
+ if (GET_PARM4(&pval_id, &pval_type, &pval_query, &pval_flags)
+ == FAILURE) {
WRONG_PARAM_COUNT;
}
if (Z_TYPE_PP(&pval_flags) != IS_ARRAY) {
pval *pval_id;
Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_parse_parameters(1, "z", &pval_id) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || GET_PARM1(&pval_id) == FAILURE) {
WRONG_PARAM_COUNT;
}
Yaz_Association p;
if (ZEND_NUM_ARGS() == 2) {
- if (zend_parse_parameters(2, "zz", &pval_id, &pval_opt) == FAILURE) {
+ if (GET_PARM2(&pval_id, &pval_opt) == FAILURE) {
WRONG_PARAM_COUNT;
}
} else if (ZEND_NUM_ARGS() == 1) {
- if (zend_parse_parameters(1, "z", &pval_id) == FAILURE) {
+ if (GET_PARM1(&pval_id) == FAILURE) {
WRONG_PARAM_COUNT;
}
} else {
Yaz_Association p;
if (ZEND_NUM_ARGS() != 2 ||
- zend_parse_parameters(2, "zz", &pval_id, &pval_package) == FAILURE) {
+ GET_PARM2(&pval_id, &pval_package) == FAILURE) {
WRONG_PARAM_COUNT;
}
ccl_qual_fitem(p->bibset, (*ent)->value.str.val, key);
}
}
- release_assoc (p);
+ release_assoc(p);
}
/* }}} */
pval *pval_id, *pval_query, *pval_res = 0;
Yaz_Association p;
- if (ZEND_NUM_ARGS() != 3 ||
- zend_parse_parameters(3, "zzz", &pval_id, &pval_query, &pval_res)
+ if (ZEND_NUM_ARGS() != 3 || GET_PARM3( &pval_id, &pval_query, &pval_res)
== FAILURE) {
WRONG_PARAM_COUNT;
}
Yaz_Association p;
if (ZEND_NUM_ARGS() != 2 ||
- zend_parse_parameters(2, "zz", &pval_id, &pval_database) == FAILURE) {
+ GET_PARM2(&pval_id, &pval_database) == FAILURE) {
WRONG_PARAM_COUNT;
}
}
}
-static void yaz_close_link (zend_rsrc_list_entry *rsrc TSRMLS_DC)
+static void yaz_close_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
Yaz_Association *as = (Yaz_Association *) rsrc->ptr;
yaz_close_session(as TSRMLS_CC);
else
yaz_log_init_level(0);
- le_link = zend_register_list_destructors_ex (yaz_close_link, 0, "YAZ link", module_number);
+ le_link = zend_register_list_destructors_ex(yaz_close_link, 0, "YAZ link", module_number);
order_associations = 1;
shared_associations = xmalloc(sizeof(*shared_associations) * MAX_ASSOC);
shared_associations = 0;
}
#ifdef ZTS
- tsrm_mutex_free (yaz_mutex);
+ tsrm_mutex_free(yaz_mutex);
#endif
yaz_log_init_file(0);