diff --git a/headers/posix/math.h b/headers/posix/math.h index edce3eb21c..9eed5322cf 100644 --- a/headers/posix/math.h +++ b/headers/posix/math.h @@ -189,7 +189,6 @@ extern double yn(int x, double y); /* other stuff as defined in BeOS */ extern int isinff(float value); extern int finitef(float value); -extern float infnanf(int error); extern float dremf(float x, float y); extern float significandf(float x); extern float copysignf(float x, float y); diff --git a/headers/posix/string.h b/headers/posix/string.h index cb660f8326..aec0079488 100644 --- a/headers/posix/string.h +++ b/headers/posix/string.h @@ -59,7 +59,6 @@ extern char *strcasestr(const char *string, const char *searchString); extern char *strdup(const char *string); extern char *stpcpy(char *dest, const char *source); -extern const char *strtcopy(char *dest, const char *source); extern size_t strlcat(char *dest, const char *source, size_t length); extern size_t strlcpy(char *dest, const char *source, size_t length); diff --git a/src/system/libroot/posix/glibc/misc/Jamfile b/src/system/libroot/posix/glibc/misc/Jamfile index 100afe1ce7..d984af7c9e 100644 --- a/src/system/libroot/posix/glibc/misc/Jamfile +++ b/src/system/libroot/posix/glibc/misc/Jamfile @@ -15,6 +15,7 @@ SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ; MergeObject posix_gnu_misc.o : dirname.c insremque.c + lsearch.c tsearch.c efgcvt.c efgcvt_r.c diff --git a/src/system/libroot/posix/glibc/misc/lsearch.c b/src/system/libroot/posix/glibc/misc/lsearch.c new file mode 100644 index 0000000000..057ff396e1 --- /dev/null +++ b/src/system/libroot/posix/glibc/misc/lsearch.c @@ -0,0 +1,59 @@ +/* Linear search functions. + Copyright (C) 1996,97,98,2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +void * +lsearch (const void *key, void *base, size_t *nmemb, size_t size, + __compar_fn_t compar) +{ + void *result; + + /* Try to find it. */ + result = lfind (key, base, nmemb, size, compar); + if (result == NULL) + { + /* Not available. Insert at the end. */ + result = memcpy (base + (*nmemb) * size, key, size); + ++(*nmemb); + } + + return result; +} + + +void * +lfind (const void *key, const void *base, size_t *nmemb, size_t size, + __compar_fn_t compar) +{ + const void *result = base; + size_t cnt = 0; + + while (cnt < *nmemb && (*compar) (key, result) != 0) + { + result += size; + ++cnt; + } + + return cnt < *nmemb ? (void *) result : NULL; +} +libc_hidden_def (lfind)