diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/hsearch_r.c | 22 | ||||
-rw-r--r-- | misc/search.h | 4 |
2 files changed, 15 insertions, 11 deletions
diff --git a/misc/hsearch_r.c b/misc/hsearch_r.c index 980b7c8..d9255e1 100644 --- a/misc/hsearch_r.c +++ b/misc/hsearch_r.c @@ -1,6 +1,6 @@ -/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1993. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as @@ -143,15 +143,6 @@ hsearch_r (item, action, retval, htab) unsigned int len = strlen (item.key); unsigned int idx; - /* If table is full and another entry should be entered return with - error. */ - if (action == ENTER && htab->filled == htab->size) - { - __set_errno (ENOMEM); - *retval = NULL; - return 0; - } - /* Compute an value for the given string. Perhaps use a better method. */ hval = len; count = len; @@ -213,6 +204,15 @@ hsearch_r (item, action, retval, htab) /* An empty bucket has been found. */ if (action == ENTER) { + /* If table is full and another entry should be entered return + with error. */ + if (action == ENTER && htab->filled == htab->size) + { + __set_errno (ENOMEM); + *retval = NULL; + return 0; + } + htab->table[idx].used = hval; htab->table[idx].entry = item; diff --git a/misc/search.h b/misc/search.h index 2b01064..1cd4fdb 100644 --- a/misc/search.h +++ b/misc/search.h @@ -52,6 +52,10 @@ extern void remque __P ((void *__elem)); #ifndef __COMPAR_FN_T # define __COMPAR_FN_T typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t)); + +# ifdef __USE_GNU +typedef __compar_fn_t comparison_fn_t; +# endif #endif /* Action which shall be performed in the call the hsearch. */ |