From 0de7f32b93af44a9ae3b5126b1ec5558fd51e14f Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Mon, 2 Dec 2002 16:20:50 +0000 Subject: Add hsearch and hsearch_r. Consolidate all functions prototyped in search.h in one directory. --- libc/misc/lsearch/Makefile | 44 -------------------------------------------- libc/misc/lsearch/lsearch.c | 38 -------------------------------------- 2 files changed, 82 deletions(-) delete mode 100644 libc/misc/lsearch/Makefile delete mode 100644 libc/misc/lsearch/lsearch.c (limited to 'libc/misc/lsearch') diff --git a/libc/misc/lsearch/Makefile b/libc/misc/lsearch/Makefile deleted file mode 100644 index 69475c960..000000000 --- a/libc/misc/lsearch/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# Makefile for uClibc -# -# Copyright (C) 2000 by Lineo, inc. -# Copyright (C) 2000,2001 Erik Andersen -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program 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 Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. - -TOPDIR=../../../ -include $(TOPDIR)Rules.mak - -CSRC=lsearch.c -COBJS=$(patsubst %.c,%.o, $(CSRC)) -OBJS=$(COBJS) - -all: $(OBJS) $(LIBC) - -$(LIBC): ar-target - -ar-target: $(OBJS) - $(AR) $(ARFLAGS) $(LIBC) $(OBJS) - -$(COBJS): %.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - $(STRIPTOOL) -x -R .note -R .comment $*.o - -clean: - rm -f *.[oa] *~ core - diff --git a/libc/misc/lsearch/lsearch.c b/libc/misc/lsearch/lsearch.c deleted file mode 100644 index 8b10fd874..000000000 --- a/libc/misc/lsearch/lsearch.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file lifted in toto from 'Dlibs' on the atari ST (RdeBath) - * - * - * Dale Schumacher 399 Beacon Ave. - * (alias: Dalnefre') St. Paul, MN 55104 - * dal@syntel.UUCP United States of America - * "It's not reality that's important, but how you perceive things." - */ - -#include -#include -#include - -void *lfind(const void *key, const void *base, size_t *nmemb, - size_t size, int (*compar)(const void *, const void *)) -{ - register int n = *nmemb; - - while (n--) { - if ((*compar) (base, key) == 0) - return ((void*)base); - base += size; - } - return (NULL); -} - -void *lsearch(const void *key, void *base, size_t *nmemb, - size_t size, int (*compar)(const void *, const void *)) -{ - register char *p; - - if ((p = lfind(key, base, nmemb, size, compar)) == NULL) { - p = memcpy((base + (size * (*nmemb))), key, size); - ++(*nmemb); - } - return (p); -} -- cgit v1.2.3