mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-25 04:01:10 +00:00
4ffb177155
The implementation of the (XSI POSIX) functions hsearch / hcreate / hdestroy uses hsearch_r / hcreate_r / hdestroy_r, which are not POSIX functions. This patch makes those into weak aliases for __*_r and uses those names for the calls within libc. Tested for x86_64 that the disassembly of installed shared libraries is unchanged by this patch. [BZ #17996] * include/search.h (hcreate_r): Don't use libc_hidden_proto. (hdestroy_r): Likewise. (hsearch_r): Likewise. (__hcreate_r): Declare and use libc_hidden_proto. (__hdestroy_r): Likewise. (__hsearch_r): Likewise. * misc/hsearch.c (hsearch): Call __hsearch_r instead of hsearch_r. (hcreate): Call __hcreate_r instead of hcreate_r. (__hdestroy): Call __hdestroy_r instead of hdestroy_r. * misc/hsearch_r.c (hcreate_r): Rename to __hcreate_r and define as weak alias of __hcreate_r. (hdestroy_r): Rename to __hdestroy_r and define as weak alias of __hdestroy_r. (hsearch_r): Rename to __hsearch_r and define as weak alias of __hsearch_r. * conform/Makefile (test-xfail-XPG3/search.h/linknamespace): Remove variable. (test-xfail-XPG4/search.h/linknamespace): Likewise. (test-xfail-UNIX98/search.h/linknamespace): Likewise. (test-xfail-XOPEN2K/search.h/linknamespace): Likewise. (test-xfail-XOPEN2K8/search.h/linknamespace): Likewise.
57 lines
1.5 KiB
C
57 lines
1.5 KiB
C
/* Copyright (C) 1993-2015 Free Software Foundation, Inc.
|
|
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
|
|
This file is part of the GNU C Library.
|
|
|
|
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, see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include <search.h>
|
|
|
|
/* The non-reentrant version use a global space for storing the table. */
|
|
static struct hsearch_data htab;
|
|
|
|
|
|
/* Define the non-reentrant function using the reentrant counterparts. */
|
|
ENTRY *
|
|
hsearch (item, action)
|
|
ENTRY item;
|
|
ACTION action;
|
|
{
|
|
ENTRY *result;
|
|
|
|
(void) __hsearch_r (item, action, &result, &htab);
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
int
|
|
hcreate (nel)
|
|
size_t nel;
|
|
{
|
|
return __hcreate_r (nel, &htab);
|
|
}
|
|
|
|
|
|
void
|
|
__hdestroy (void)
|
|
{
|
|
__hdestroy_r (&htab);
|
|
}
|
|
weak_alias (__hdestroy, hdestroy)
|
|
|
|
/* Make sure the table is freed if we want to free everything before
|
|
exiting. */
|
|
text_set_element (__libc_subfreeres, __hdestroy);
|