From 3726bf6622da6a8b983bb4cbb7d654e84c3216d7 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 14 Jul 1999 10:59:26 +0000 Subject: [PATCH] Changed functions isc_getmethod, isams_getmethod. Improved fatal error handling (such as missing EXPLAIN schema). --- CHANGELOG | 2 + configure | 72 +++++++++++++++++++++------ configure.in | 5 +- include/isamc.h | 8 ++- include/isams.h | 4 +- index/index.h | 10 ++-- index/invstat.c | 14 ++++-- index/kcompare.c | 24 ++++----- index/kinput.c | 12 +++-- index/main.c | 8 ++- index/zebraapi.c | 145 ++++++++++++++++++++++++++++++++++-------------------- index/zserver.c | 7 ++- index/zserver.h | 20 +++----- isamc/isamc.c | 13 ++--- isamc/isams.c | 12 ++--- 15 files changed, 228 insertions(+), 128 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f8d2922..b151131 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +Added support for multiple records in one file for filter grs.sgml. + Changed record index structure. New layout is incompatible with previous releases. Added setting "recordcompression" to control compression of records. Possible values are "none" (no diff --git a/configure b/configure index 5c85f88..b83c502 100755 --- a/configure +++ b/configure @@ -1243,8 +1243,48 @@ fi fi +for ac_hdr in sys/times.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1251: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1261: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + echo $ac_n "checking for main in -lwrap""... $ac_c" 1>&6 -echo "configure:1248: checking for main in -lwrap" >&5 +echo "configure:1288: checking for main in -lwrap" >&5 ac_lib_var=`echo wrap'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1252,14 +1292,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lwrap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1280,7 +1320,7 @@ else fi echo $ac_n "checking for bzCompressInit in -lbz2""... $ac_c" 1>&6 -echo "configure:1284: checking for bzCompressInit in -lbz2" >&5 +echo "configure:1324: checking for bzCompressInit in -lbz2" >&5 ac_lib_var=`echo bz2'_'bzCompressInit | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1288,7 +1328,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbz2 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1331,17 +1371,17 @@ if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1335: checking for $ac_hdr" >&5 +echo "configure:1375: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1345: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1385: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1369,12 +1409,12 @@ done fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1373: checking for ANSI C header files" >&5 +echo "configure:1413: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1382,7 +1422,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1386: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1426: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1399,7 +1439,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1417,7 +1457,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1438,7 +1478,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1449,7 +1489,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else diff --git a/configure.in b/configure.in index 61bf5ea..cdb3f48 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Zebra, Index Data Aps, 1994-1999 -dnl $Id: configure.in,v 1.9 1999-06-25 13:48:02 adam Exp $ +dnl $Id: configure.in,v 1.10 1999-07-14 10:59:26 adam Exp $ dnl See the file LICENSE.2 for details. dnl AC_INIT(include/zebraver.h) @@ -59,6 +59,9 @@ if test "$checkBoth" = "1"; then fi AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"])) dnl +dnl ------ times +AC_CHECK_HEADERS(sys/times.h) +dnl dnl ------ TCP wrapper (for Linux) AC_CHECK_LIB(wrap, main, [LIBS="$LIBS -lwrap"]) dnl diff --git a/include/isamc.h b/include/isamc.h index 37af9d2..6b80198 100644 --- a/include/isamc.h +++ b/include/isamc.h @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: isamc.h,v $ - * Revision 1.8 1999-06-30 09:08:23 adam + * Revision 1.9 1999-07-14 10:59:26 adam + * Changed functions isc_getmethod, isams_getmethod. + * Improved fatal error handling (such as missing EXPLAIN schema). + * + * Revision 1.8 1999/06/30 09:08:23 adam * Added coder to reset. * * Revision 1.7 1998/03/13 15:30:50 adam @@ -75,7 +79,7 @@ typedef struct ISAMC_I_s { void *clientData; } *ISAMC_I; -ISAMC_M isc_getmethod (void); +void isc_getmethod (ISAMC_M m); ISAMC isc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M method); int isc_close (ISAMC is); diff --git a/include/isams.h b/include/isams.h index a853b57..bcde9d8 100644 --- a/include/isams.h +++ b/include/isams.h @@ -3,7 +3,7 @@ * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * - * $Id: isams.h,v 1.1 1999-05-12 13:08:06 adam Exp $ + * $Id: isams.h,v 1.2 1999-07-14 10:59:26 adam Exp $ */ #ifndef ISAMS_H #define ISAMS_H @@ -36,7 +36,7 @@ typedef struct ISAMS_I_s { void *clientData; } *ISAMS_I; -ISAMS_M isams_getmethod (void); +void isams_getmethod (ISAMS_M me); ISAMS isams_open (BFiles bfs, const char *name, int writeflag, ISAMS_M method); diff --git a/index/index.h b/index/index.h index dd7166e..b3f906d 100644 --- a/index/index.h +++ b/index/index.h @@ -99,8 +99,8 @@ void key_logdump (int mask, const void *p); void inv_prstat (BFiles bfs); void inv_compact (BFiles bfs); void key_input (BFiles bfs, int nkeys, int cache); -ISAMC_M key_isamc_m (Res res); -ISAMS_M key_isams_m (Res res); +ISAMC_M key_isamc_m (Res res, ISAMC_M me); +ISAMS_M key_isams_m (Res res, ISAMS_M me); ISAMH_M key_isamh_m (Res res); int merge_sort (char **buf, int from, int to); int key_SU_code (int ch, char *out); @@ -158,7 +158,11 @@ extern Res common_resource; /* * $Log: index.h,v $ - * Revision 1.64 1999-06-30 15:07:23 heikki + * Revision 1.65 1999-07-14 10:59:26 adam + * Changed functions isc_getmethod, isams_getmethod. + * Improved fatal error handling (such as missing EXPLAIN schema). + * + * Revision 1.64 1999/06/30 15:07:23 heikki * Adding isamh stuff * * Revision 1.63 1999/05/26 07:49:13 adam diff --git a/index/invstat.c b/index/invstat.c index fdab6ba..5c9779d 100644 --- a/index/invstat.c +++ b/index/invstat.c @@ -150,7 +150,9 @@ void inv_prstat (BFiles bfs) } else if (res_get_match (common_resource, "isam", "s", NULL)) { - isams = isams_open (bfs, FNAME_ISAMS, 0, key_isams_m(common_resource)); + struct ISAMS_M_s isams_m; + isams = isams_open (bfs, FNAME_ISAMS, 0, + key_isams_m(common_resource, &isams_m)); if (!isams) { logf (LOG_FATAL, "isams_open fail"); @@ -168,7 +170,9 @@ void inv_prstat (BFiles bfs) } else { - isamc = isc_open (bfs, FNAME_ISAMC, 0, key_isamc_m (common_resource)); + struct ISAMC_M_s isamc_m; + isamc = isc_open (bfs, FNAME_ISAMC, 0, + key_isamc_m (common_resource, &isamc_m)); if (!isamc) { logf (LOG_FATAL, "isc_open fail"); @@ -261,7 +265,11 @@ void inv_prstat (BFiles bfs) /* * * $Log: invstat.c,v $ - * Revision 1.13 1999-07-08 14:23:27 heikki + * Revision 1.14 1999-07-14 10:59:26 adam + * Changed functions isc_getmethod, isams_getmethod. + * Improved fatal error handling (such as missing EXPLAIN schema). + * + * Revision 1.13 1999/07/08 14:23:27 heikki * Fixed a bug in isamh_pp_read and cleaned up a bit * * Revision 1.12 1999/07/06 12:28:04 adam diff --git a/index/kcompare.c b/index/kcompare.c index cb4ffc7..ec85430 100644 --- a/index/kcompare.c +++ b/index/kcompare.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: kcompare.c,v $ - * Revision 1.32 1999-07-13 13:21:15 heikki + * Revision 1.33 1999-07-14 10:59:26 adam + * Changed functions isc_getmethod, isams_getmethod. + * Improved fatal error handling (such as missing EXPLAIN schema). + * + * Revision 1.32 1999/07/13 13:21:15 heikki * Managing negative deltas * * Revision 1.31 1999/07/06 09:37:04 heikki @@ -307,14 +311,9 @@ static void iscz1_code_item (int mode, void *vp, char **dst, char **src) } } -ISAMC_M key_isamc_m (Res res) +ISAMC_M key_isamc_m (Res res, ISAMC_M me) { - static ISAMC_M me = NULL; - - if (me) - return me; - - me = isc_getmethod (); + isc_getmethod (me); me->compare_item = key_compare; @@ -328,14 +327,9 @@ ISAMC_M key_isamc_m (Res res) return me; } -ISAMS_M key_isams_m (Res res) +ISAMS_M key_isams_m (Res res, ISAMS_M me) { - static ISAMS_M me = NULL; - - if (me) - return me; - - me = isams_getmethod (); + isams_getmethod (me); me->compare_item = key_compare; diff --git a/index/kinput.c b/index/kinput.c index 4a635c0..b2cf034 100644 --- a/index/kinput.c +++ b/index/kinput.c @@ -619,8 +619,9 @@ void key_input (BFiles bfs, int nkeys, int cache) } if (res_get_match (common_resource, "isam", "s", NULL)) { + struct ISAMS_M_s isams_m; isams = isams_open (bfs, FNAME_ISAMS, 1, - key_isams_m (common_resource)); + key_isams_m (common_resource, &isams_m)); if (!isams) { logf (LOG_FATAL, "isams_open fail"); @@ -649,8 +650,9 @@ void key_input (BFiles bfs, int nkeys, int cache) } else { + struct ISAMC_M_s isamc_m; isamc = isc_open (bfs, FNAME_ISAMC, 1, - key_isamc_m (common_resource)); + key_isamc_m (common_resource, &isamc_m)); if (!isamc) { logf (LOG_FATAL, "isc_open fail"); @@ -715,7 +717,11 @@ void key_input (BFiles bfs, int nkeys, int cache) /* * $Log: kinput.c,v $ - * Revision 1.35 1999-06-30 15:07:23 heikki + * Revision 1.36 1999-07-14 10:59:26 adam + * Changed functions isc_getmethod, isams_getmethod. + * Improved fatal error handling (such as missing EXPLAIN schema). + * + * Revision 1.35 1999/06/30 15:07:23 heikki * Adding isamh stuff * * Revision 1.34 1999/05/26 07:49:13 adam diff --git a/index/main.c b/index/main.c index 04f332b..6ca0946 100644 --- a/index/main.c +++ b/index/main.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: main.c,v $ - * Revision 1.67 1999-07-06 12:28:04 adam + * Revision 1.68 1999-07-14 10:59:26 adam + * Changed functions isc_getmethod, isams_getmethod. + * Improved fatal error handling (such as missing EXPLAIN schema). + * + * Revision 1.67 1999/07/06 12:28:04 adam * Updated record index structure. Format includes version ID. Compression * algorithm ID is stored for each record block. * @@ -276,7 +280,7 @@ int main (int argc, char **argv) int cmd = 0; char *arg; char *configName = NULL; - int nsections; + int nsections = 0; int disableCommit = 0; size_t mem_max = 0; diff --git a/index/zebraapi.c b/index/zebraapi.c index 74400fb..0d9d815 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zebraapi.c,v $ - * Revision 1.20 1999-07-06 12:28:04 adam + * Revision 1.21 1999-07-14 10:59:26 adam + * Changed functions isc_getmethod, isams_getmethod. + * Improved fatal error handling (such as missing EXPLAIN schema). + * + * Revision 1.20 1999/07/06 12:28:04 adam * Updated record index structure. Format includes version ID. Compression * algorithm ID is stored for each record block. * @@ -98,11 +102,18 @@ static void zebra_chdir (ZebraHandle zh) chdir (dir); #endif } + +static void zebra_register_unlock (ZebraHandle zh); + static int zebra_register_lock (ZebraHandle zh) { time_t lastChange; int state; + zh->errCode = 0; + zh->errString = 0; + zh->hits = 0; + zebra_chdir (zh); state = zebra_server_lock_get_state(zh, &lastChange); @@ -116,7 +127,7 @@ static int zebra_register_lock (ZebraHandle zh) state = 0; } zebra_server_lock (zh, state); -#if USE_TIMES +#if HAVE_SYS_TIMES_H times (&zh->tms1); #endif if (zh->registerState == state) @@ -135,59 +146,87 @@ static int zebra_register_lock (ZebraHandle zh) if (zh->records) { zebraExplain_close (zh->zei, 0, 0); - dict_close (zh->dict); - sortIdx_close (zh->sortIdx); + if (zh->dict) + dict_close (zh->dict); + if (zh->sortIdx) + sortIdx_close (zh->sortIdx); if (zh->isam) is_close (zh->isam); if (zh->isamc) isc_close (zh->isamc); + if (zh->isams) + isams_close (zh->isams); rec_close (&zh->records); } bf_cache (zh->bfs, state ? res_get (zh->res, "shadow") : NULL); zh->registerState = state; - zh->records = rec_open (zh->bfs, 0, 0); - if (!(zh->dict = dict_open (zh->bfs, FNAME_DICT, 40, 0, 0))) - { - logf (LOG_WARN, "dict_open"); - return -1; - } - if (!(zh->sortIdx = sortIdx_open (zh->bfs, 0))) - { - logf (LOG_WARN, "sortIdx_open"); - return -1; - } + zh->isam = NULL; zh->isamc = NULL; zh->isams = NULL; - if (res_get_match (zh->res, "isam", "i", NULL)) + zh->dict = NULL; + zh->sortIdx = NULL; + zh->zei = NULL; + + if (!(zh->records = rec_open (zh->bfs, 0, 0))) { - if (!(zh->isam = is_open (zh->bfs, FNAME_ISAM, key_compare, 0, - sizeof (struct it_key), zh->res))) - { - logf (LOG_WARN, "is_open"); - return -1; - } + logf (LOG_WARN, "rec_open"); + zh->errCode = 2; } - else if (res_get_match (zh->res, "isam", "s", NULL)) + else { - if (!(zh->isams = isams_open (zh->bfs, FNAME_ISAMS, 0, - key_isams_m(zh->res)))) + if (!(zh->dict = dict_open (zh->bfs, FNAME_DICT, 40, 0, 0))) { - logf (LOG_WARN, "isams_open"); - return -1; + logf (LOG_WARN, "dict_open"); + zh->errCode = 2; } - } - else - { - if (!(zh->isamc = isc_open (zh->bfs, FNAME_ISAMC, - 0, key_isamc_m(zh->res)))) + if (!(zh->sortIdx = sortIdx_open (zh->bfs, 0))) + { + logf (LOG_WARN, "sortIdx_open"); + zh->errCode = 2; + } + if (res_get_match (zh->res, "isam", "i", NULL)) + { + if (!(zh->isam = is_open (zh->bfs, FNAME_ISAM, key_compare, 0, + sizeof (struct it_key), zh->res))) + { + logf (LOG_WARN, "is_open"); + zh->errCode = 2; + } + } + else if (res_get_match (zh->res, "isam", "s", NULL)) { - logf (LOG_WARN, "isc_open"); - return -1; + struct ISAMS_M_s isams_m; + if (!(zh->isams = isams_open (zh->bfs, FNAME_ISAMS, 0, + key_isams_m(zh->res, &isams_m)))) + { + logf (LOG_WARN, "isams_open"); + zh->errCode = 2; + } + } + else + { + struct ISAMC_M_s isamc_m; + if (!(zh->isamc = isc_open (zh->bfs, FNAME_ISAMC, + 0, key_isamc_m(zh->res, &isamc_m)))) + { + logf (LOG_WARN, "isc_open"); + zh->errCode = 2; + } + } + zh->zei = zebraExplain_open (zh->records, zh->dh, zh->res, 0, 0, 0); + if (!zh->zei) + { + logf (LOG_WARN, "Cannot obtain EXPLAIN information"); + zh->errCode = 2; } } - zh->zei = zebraExplain_open (zh->records, zh->dh, zh->res, 0, 0, 0); - + if (zh->errCode) + { + zebra_register_unlock (zh); + zh->registerState = -1; + return -1; + } return 0; } @@ -195,7 +234,7 @@ static void zebra_register_unlock (ZebraHandle zh) { static int waitSec = -1; -#if USE_TIMES +#if HAVE_SYS_TIMES_H times (&zh->tms2); logf (LOG_LOG, "user/system: %ld/%ld", (long) (zh->tms2.tms_utime - zh->tms1.tms_utime), @@ -220,8 +259,9 @@ static void zebra_register_unlock (ZebraHandle zh) ZebraHandle zebra_open (const char *configName) { - ZebraHandle zh = (ZebraHandle) xmalloc (sizeof(*zh)); + ZebraHandle zh; + zh = (ZebraHandle) xmalloc (sizeof(*zh)); if (!(zh->res = res_open (configName))) { logf (LOG_WARN, "Failed to read resources `%s'", configName); @@ -291,6 +331,7 @@ void zebra_close (ZebraHandle zh) passwd_db_close (zh->passwd_db); res_close (zh->res); xfree (zh); + xmalloc_trav("x"); } struct map_baseinfo { @@ -365,11 +406,8 @@ void zebra_search_rpn (ZebraHandle zh, ODR stream, ODR decode, Z_RPNQuery *query, int num_bases, char **basenames, const char *setname) { - zebra_register_lock (zh); - zh->errCode = 0; - zh->errString = NULL; - zh->hits = 0; - + if (zebra_register_lock (zh)) + return; map_basenames (zh, stream, &num_bases, &basenames); resultSetAddRPN (zh, stream, decode, query, num_bases, basenames, setname); @@ -384,14 +422,11 @@ void zebra_records_retrieve (ZebraHandle zh, ODR stream, ZebraPosSet poset; int i, *pos_array; - zh->errCode = 0; - zh->errString = NULL; + if (zebra_register_lock (zh)) + return; pos_array = (int *) xmalloc (num_recs * sizeof(*pos_array)); for (i = 0; ierrCode = 0; - zh->errString = NULL; - zebra_register_lock (zh); + if (zebra_register_lock (zh)) + { + *entries = 0; + *num_entries = 0; + return; + } map_basenames (zh, stream, &num_bases, &basenames); rpn_scan (zh, stream, zapt, attributeset, num_bases, basenames, position, @@ -450,9 +488,8 @@ void zebra_sort (ZebraHandle zh, ODR stream, const char *output_setname, Z_SortKeySpecList *sort_sequence, int *sort_status) { - zh->errCode = 0; - zh->errString = NULL; - zebra_register_lock (zh); + if (zebra_register_lock (zh)) + return; resultSetSort (zh, stream->mem, num_input_setnames, input_setnames, output_setname, sort_sequence, sort_status); zebra_register_unlock (zh); diff --git a/index/zserver.c b/index/zserver.c index 61c3881..e78e871 100644 --- a/index/zserver.c +++ b/index/zserver.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zserver.c,v $ - * Revision 1.70 1999-06-10 12:14:56 adam + * Revision 1.71 1999-07-14 10:59:26 adam + * Changed functions isc_getmethod, isams_getmethod. + * Improved fatal error handling (such as missing EXPLAIN schema). + * + * Revision 1.70 1999/06/10 12:14:56 adam * Fixed to use bend_start instead of pre_init. * * Revision 1.69 1999/06/10 09:20:03 adam @@ -263,7 +267,6 @@ #endif #include -#include #include "zserver.h" diff --git a/index/zserver.h b/index/zserver.h index e8f7905..18bde7d 100644 --- a/index/zserver.h +++ b/index/zserver.h @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zserver.h,v $ - * Revision 1.42 1999-05-26 07:49:13 adam + * Revision 1.43 1999-07-14 10:59:27 adam + * Changed functions isc_getmethod, isams_getmethod. + * Improved fatal error handling (such as missing EXPLAIN schema). + * + * Revision 1.42 1999/05/26 07:49:13 adam * C++ compilation. * * Revision 1.41 1999/05/12 13:08:06 adam @@ -149,16 +153,7 @@ * */ - -#ifndef USE_TIMES -#ifdef __linux__ -#define USE_TIMES 1 -#else -#define USE_TIMES 0 -#endif -#endif - -#if USE_TIMES +#if HAVE_SYS_TIMES_H #include #endif @@ -210,7 +205,7 @@ struct zebra_info { ZebraLockHandle server_lock_cmt; ZebraLockHandle server_lock_org; char *server_path_prefix; -#if USE_TIMES +#if HAVE_SYS_TIMES_H struct tms tms1; struct tms tms2; #endif @@ -220,7 +215,6 @@ struct zebra_info { Passwd_db passwd_db; }; - struct rank_control { char *name; void *(*create)(ZebraHandle zh); diff --git a/isamc/isamc.c b/isamc/isamc.c index 842befa..d5a1bd1 100644 --- a/isamc/isamc.c +++ b/isamc/isamc.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: isamc.c,v $ - * Revision 1.18 1999-06-30 09:08:23 adam + * Revision 1.19 1999-07-14 10:59:27 adam + * Changed functions isc_getmethod, isams_getmethod. + * Improved fatal error handling (such as missing EXPLAIN schema). + * + * Revision 1.18 1999/06/30 09:08:23 adam * Added coder to reset. * * Revision 1.17 1999/05/26 07:49:14 adam @@ -91,8 +95,9 @@ static void init_fc (ISAMC is, int cat); #define SMALL_TEST 0 -ISAMC_M isc_getmethod (void) +void isc_getmethod (ISAMC_M m) { + static struct ISAMC_filecat_s def_cat[] = { #if SMALL_TEST { 32, 28, 0, 3 }, @@ -106,7 +111,6 @@ ISAMC_M isc_getmethod (void) { 32768, 32000, 31000, 0 }, #endif }; - ISAMC_M m = (ISAMC_M) xmalloc (sizeof(*m)); m->filecat = def_cat; m->code_start = NULL; @@ -119,11 +123,8 @@ ISAMC_M isc_getmethod (void) m->debug = 1; m->max_blocks_mem = 10; - - return m; } - ISAMC isc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M method) { ISAMC is; diff --git a/isamc/isams.c b/isamc/isams.c index 7135685..f9b5dbe 100644 --- a/isamc/isams.c +++ b/isamc/isams.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: isams.c,v $ - * Revision 1.4 1999-05-26 07:49:14 adam + * Revision 1.5 1999-07-14 10:59:27 adam + * Changed functions isc_getmethod, isams_getmethod. + * Improved fatal error handling (such as missing EXPLAIN schema). + * + * Revision 1.4 1999/05/26 07:49:14 adam * C++ compilation. * * Revision 1.3 1999/05/20 12:57:18 adam @@ -53,10 +57,8 @@ struct ISAMS_PP_s { int numRead; }; -ISAMS_M isams_getmethod (void) +void isams_getmethod (ISAMS_M m) { - ISAMS_M m = (ISAMS_M) xmalloc (sizeof(*m)); - m->code_start = NULL; m->code_item = NULL; m->code_stop = NULL; @@ -65,8 +67,6 @@ ISAMS_M isams_getmethod (void) m->debug = 1; m->block_size = 128; - - return m; } ISAMS isams_open (BFiles bfs, const char *name, int writeflag, -- 1.7.10.4