summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--wince/stdlib.c18
2 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 1e0f923..cca0f23 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 a2ac340..d371b12 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;
+}
+