X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzoom-record-cache.c;h=0b22b33d3972acd57cb478dfa6371332c0cd9335;hp=d9d3765b3c0558a18d941f64608ceb23b7cc20c4;hb=e7c4df57d3838ac1c0c15569daec2d118f4abb2c;hpb=5242cb5a8634bfa38b9333ff7f903e718ac6e292 diff --git a/src/zoom-record-cache.c b/src/zoom-record-cache.c index d9d3765..0b22b33 100644 --- a/src/zoom-record-cache.c +++ b/src/zoom-record-cache.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2012 Index Data + * Copyright (C) 1995-2013 Index Data * See the file LICENSE for details. */ /** @@ -49,16 +49,6 @@ struct ZOOM_record_cache_p { 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) @@ -80,9 +70,9 @@ void ZOOM_record_cache_add(ZOOM_resultset r, Z_NamePlusRecord *npr, 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) @@ -136,11 +126,11 @@ ZOOM_record ZOOM_record_cache_lookup(ZOOM_resultset r, int pos, { 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; }