]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(lsearch): Return a pointer to the new element if one was "allocated".
authorUlrich Drepper <drepper@redhat.com>
Fri, 30 Jan 1998 17:07:17 +0000 (17:07 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 30 Jan 1998 17:07:17 +0000 (17:07 +0000)
misc/lsearch.c

index 4bc0414088a23ffacdbb01407a87fe9dc3025d35..68f89be8ca5f092b826ac68ce5f95f18d484533e 100644 (file)
@@ -1,5 +1,5 @@
 /* Linear search functions.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -33,7 +33,7 @@ lsearch (const void *key, void *base, size_t *nmemb, size_t size,
   if (result == NULL)
     {
       /* Not available.  Insert at the end.  */
-      memcpy (base + (*nmemb) * size, key, size);
+      result = memcpy (base + (*nmemb) * size, key, size);
       ++(*nmemb);
     }