summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruema2 <uema2@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-19 10:02:57 +0000
committeruema2 <uema2@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-19 10:02:57 +0000
commitc7d2ebd71ee024db66c1630fed24d83fead4ac35 (patch)
tree9ce72e7e90dd4f9d964cb976e68667637ce39c6a
parent6d696136d53d8cce2e2b931abdc3dae248894954 (diff)
* wince/stdlib.c: add bsearch().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--wince/stdlib.c18
2 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 1e0f923e30..cca0f235bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sat Jul 19 19:03:24 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * wince/stdlib.c: add bsearch().
+
Sat Jul 19 11:27:25 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (thgroup_add): do not raise ThreadError on terminated
diff --git a/wince/stdlib.c b/wince/stdlib.c
index a2ac340de4..d371b12f88 100644
--- a/wince/stdlib.c
+++ b/wince/stdlib.c
@@ -37,3 +37,21 @@ int mblen(const char *mbstr, size_t count)
return n;
}
+
+void *bsearch( const void *key, const void *base,
+ size_t num, size_t width,
+ int ( __cdecl *compare )(const void *, const void *))
+{
+ size_t i;
+ const void* p = base;
+ const char* px;
+
+ for( i=0; i<num; i++ )
+ {
+ if( 0==compare( key, p ) )
+ return (void*)p;
+ px = (const char*)p; px+=width; p=(const void*)px;
+ }
+ return NULL;
+}
+