4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-19 04:49:25 +08:00

* libc/include/search.h (__compar_fn_t): Add typedef.

(tdelete, tfind, tsearch): Use it.
* libc/include/stdlib.h (__compar_fn_t): Add typedef.
(bsearch, qsort): Use it.
This commit is contained in:
Yaakov Selkowitz 2013-09-08 07:11:33 +00:00
parent 3c654cd48a
commit 45070312d4
3 changed files with 22 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2013-09-08 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* libc/include/search.h (__compar_fn_t): Add typedef.
(tdelete, tfind, tsearch): Use it.
* libc/include/stdlib.h (__compar_fn_t): Add typedef.
(bsearch, qsort): Use it.
2013-08-19 Meador Inge <meadori@codesourcery.com>
* libc/stdlib/__atexit.c (__register_exitproc): NULL-ify

View File

@ -42,6 +42,11 @@ struct hsearch_data
size_t htablesize;
};
#ifndef __compar_fn_t_defined
#define __compar_fn_t_defined
typedef int (*__compar_fn_t) (const void *, const void *);
#endif
__BEGIN_DECLS
int hcreate(size_t);
void hdestroy(void);
@ -49,10 +54,10 @@ ENTRY *hsearch(ENTRY, ACTION);
int hcreate_r(size_t, struct hsearch_data *);
void hdestroy_r(struct hsearch_data *);
int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
void *tdelete(const void *, void **, int (*)(const void *, const void *));
void *tdelete(const void *, void **, __compar_fn_t);
void tdestroy (void *, void (*)(void *));
void *tfind(const void *, void **, int (*)(const void *, const void *));
void *tsearch(const void *, void **, int (*)(const void *, const void *));
void *tfind(const void *, void **, __compar_fn_t);
void *tsearch(const void *, void **, __compar_fn_t);
void twalk(const void *, void (*)(const void *, VISIT, int));
__END_DECLS

View File

@ -47,6 +47,11 @@ typedef struct
} lldiv_t;
#endif
#ifndef __compar_fn_t_defined
#define __compar_fn_t_defined
typedef int (*__compar_fn_t) (const _PTR, const _PTR);
#endif
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
@ -71,7 +76,7 @@ _PTR _EXFUN(bsearch,(const _PTR __key,
const _PTR __base,
size_t __nmemb,
size_t __size,
int _EXFNPTR(_compar,(const _PTR, const _PTR))));
__compar_fn_t _compar));
_PTR _EXFUN_NOTHROW(calloc,(size_t __nmemb, size_t __size));
div_t _EXFUN(div,(int __numer, int __denom));
_VOID _EXFUN(exit,(int __status) _ATTRIBUTE ((noreturn)));
@ -113,7 +118,7 @@ int _EXFUN(_mkstemp_r, (struct _reent *, char *));
int _EXFUN(_mkstemps_r, (struct _reent *, char *, int));
char * _EXFUN(_mktemp_r, (struct _reent *, char *) _ATTRIBUTE ((__warning__ ("the use of `mktemp' is dangerous; use `mkstemp' instead"))));
#endif
_VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR)));
_VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, __compar_fn_t _compar));
int _EXFUN(rand,(_VOID));
_PTR _EXFUN_NOTHROW(realloc,(_PTR __r, size_t __size));
#ifndef __STRICT_ANSI__