[Namazu-cvs 746] r211 - Search-Namazu/trunk

cvsd @ vaj.namazu.org cvsd @ vaj.namazu.org
2006年 3月 24日 (金) 11:48:54 JST


Author: knok
Date: 2006-03-24 11:48:53 +0900 (Fri, 24 Mar 2006)
New Revision: 211

Modified:
   Search-Namazu/trunk/ChangeLog
   Search-Namazu/trunk/Namazu.pm
   Search-Namazu/trunk/Namazu.xs
Log:
Return status info.


Modified: Search-Namazu/trunk/ChangeLog
===================================================================
--- Search-Namazu/trunk/ChangeLog	2006-03-23 07:52:25 UTC (rev 210)
+++ Search-Namazu/trunk/ChangeLog	2006-03-24 02:48:53 UTC (rev 211)
@@ -1,3 +1,9 @@
+2006-03-24  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
+
+	* Namazu.{xs,pm}: Removed errono.
+	  Added a global variable "status".
+	  Added nmz_getstatus() func.
+
 2006-03-23  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
 
 	* Namazu.{xs,pm} : Added errno check.

Modified: Search-Namazu/trunk/Namazu.pm
===================================================================
--- Search-Namazu/trunk/Namazu.pm	2006-03-23 07:52:25 UTC (rev 210)
+++ Search-Namazu/trunk/Namazu.pm	2006-03-24 02:48:53 UTC (rev 211)
@@ -212,8 +212,9 @@
 sub NMZ_ERR_EMPTY_QUERY { return -3; }
 sub NMZ_ERR_RESULT_EXCEEDED { return -4; }
 
-# errno
-sub ERR_TOO_MUCH_HIT { return 6; }
+# nmz_stat
+sub NMZ_SUCCESS { return 0; }
+sub NMZ_ERR_TOO_MUCH_HIT { return 6; }
 
 sub Search {
     my %args = @_;
@@ -282,9 +283,9 @@
 
     my @hlists = call_search_main($query);
 
-    my $errno = nmz_geterrno();
-    if ($errno == ERR_TOO_MUCH_HIT) {
-	return NMZ_ERR_RESULT_EXCEEDED;
+    my $status = nmz_getstatus();
+    if ($status != NMZ_SUCCESS) {
+	return $status;
     }
 
 # return objects

Modified: Search-Namazu/trunk/Namazu.xs
===================================================================
--- Search-Namazu/trunk/Namazu.xs	2006-03-23 07:52:25 UTC (rev 210)
+++ Search-Namazu/trunk/Namazu.xs	2006-03-24 02:48:53 UTC (rev 211)
@@ -42,7 +42,6 @@
 #include <namazu/search.h>
 #include <namazu/util.h>
 #include <namazu/wakati.h>
-#include <errno.h>
 #ifdef __cplusplus
 }
 #endif
@@ -57,6 +56,8 @@
 
 #define SEARCH_NAMAZU_FIELDS 5
 
+static int status = 0;
+
 MODULE = Search::Namazu		PACKAGE = Search::Namazu
 
 PROTOTYPES: DISABLE
@@ -73,11 +74,13 @@
 		NmzResult hlist;
 		char result[SEARCH_NAMAZU_FIELDS][BUFSIZE];
 
+		status = 0;
 		qstr = SvPV(query, PL_na);
 		nmz_codeconv_query(qstr);
 		strcpy(cqstr, qstr);
 		retar = newAV();
 		hlist = nmz_search(cqstr);
+		status = hlist.stat;
 		for (i = 0; i < hlist.num; i ++) {
 			SV *ohlist = perl_eval_pv("new Search::Namazu::Result", TRUE);
 			dSP;
@@ -175,8 +178,8 @@
 		nmz_set_maxhit(max);
 
 int
-nmz_geterrno()
+nmz_getstatus()
 	CODE:
-		RETVAL = errno
+		RETVAL = status;
 	OUTPUT:
 		RETVAL




Namazu-cvs メーリングリストの案内