summaryrefslogtreecommitdiff
path: root/libc/misc/search/_hsearch_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/search/_hsearch_r.c')
-rw-r--r--libc/misc/search/_hsearch_r.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/libc/misc/search/_hsearch_r.c b/libc/misc/search/_hsearch_r.c
index c9c4a9ccf..7b57ce16c 100644
--- a/libc/misc/search/_hsearch_r.c
+++ b/libc/misc/search/_hsearch_r.c
@@ -13,12 +13,11 @@
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. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <errno.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <string.h>
#include <search.h>
@@ -49,12 +48,12 @@ _ENTRY;
static int isprime (unsigned int number)
{
/* no even number will be passed */
- unsigned int div = 3;
+ unsigned int divisor = 3;
- while (div * div < number && number % div != 0)
- div += 2;
+ while (divisor * divisor < number && number % divisor != 0)
+ divisor += 2;
- return number % div != 0;
+ return number % divisor != 0;
}
@@ -64,7 +63,6 @@ static int isprime (unsigned int number)
indexing as explained in the comment for the hsearch function.
The contents of the table is zeroed, especially the field used
becomes zero. */
-libc_hidden_proto(hcreate_r)
int hcreate_r (size_t nel, struct hsearch_data *htab)
{
/* Test for correct arguments. */
@@ -100,7 +98,6 @@ libc_hidden_def(hcreate_r)
#ifdef L_hdestroy_r
/* After using the hash table it has to be destroyed. The used memory can
be freed and the local static variable can be marked as not used. */
-libc_hidden_proto(hdestroy_r)
void hdestroy_r (struct hsearch_data *htab)
{
/* Test for correct arguments. */
@@ -134,10 +131,7 @@ libc_hidden_def(hdestroy_r)
equality of the stored and the parameter value. This helps to prevent
unnecessary expensive calls of strcmp. */
-/* Experimentally off - libc_hidden_proto(strcmp) */
-/* Experimentally off - libc_hidden_proto(strlen) */
-libc_hidden_proto(hsearch_r)
int hsearch_r (ENTRY item, ACTION action, ENTRY **retval,
struct hsearch_data *htab)
{