*/
YAZ_EXPORT int yaz_strcasecmp(const char *s1, const char *s2);
+/** \brief strcmp, null may be passed
+ \param s1 first buffer or NULL
+ \param s2 second buffer or NULL
+ \retval 0 buffers are equal
+ \retval >0 a > b
+ \retval <0 a < b
+*/
+YAZ_EXPORT int yaz_strcmp_null(const char *s1, const char *s2);
YAZ_END_CDECL
ZOOM_record_cache next;
};
-
-static int strcmp_null(const char *v1, const char *v2)
-{
- if (!v1 && !v2)
- return 0;
- if (!v1 || !v2)
- return -1;
- return strcmp(v1, v2);
-}
-
static size_t record_hash(int pos)
{
if (pos < 0)
for (rc = r->record_hash[record_hash(pos)]; rc; rc = rc->next)
{
if (pos == rc->pos
- && strcmp_null(r->schema, rc->schema) == 0
- && strcmp_null(elementSetName,rc->elementSetName) == 0
- && strcmp_null(syntax, rc->syntax) == 0)
+ && yaz_strcmp_null(r->schema, rc->schema) == 0
+ && yaz_strcmp_null(elementSetName,rc->elementSetName) == 0
+ && yaz_strcmp_null(syntax, rc->syntax) == 0)
break;
}
if (!rc)
{
if (pos == rc->pos)
{
- if (strcmp_null(r->schema, rc->schema))
+ if (yaz_strcmp_null(r->schema, rc->schema))
continue;
- if (strcmp_null(elementSetName,rc->elementSetName))
+ if (yaz_strcmp_null(elementSetName,rc->elementSetName))
continue;
- if (strcmp_null(syntax, rc->syntax))
+ if (yaz_strcmp_null(syntax, rc->syntax))
continue;
return &rc->rec;
}