/* A GNU-like <search.h>.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#define _GL_SEARCH_H
-/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
+/* The definition of _GL_WARN_ON_USE is copied here. */
#ifdef __cplusplus
If one is found, it is returned. Otherwise, a new element equal to KEY
is inserted in the tree and is returned. */
extern void * tsearch (const void *key, void **vrootp,
- int (*compar) (const void *, const void *));
+ int (*compar) (const void *, const void *))
+ _GL_ARG_NONNULL ((1, 2, 3));
/* Searches an element in the tree *VROOTP that compares equal to KEY.
If one is found, it is returned. Otherwise, NULL is returned. */
extern void * tfind (const void *key, void *const *vrootp,
- int (*compar) (const void *, const void *));
+ int (*compar) (const void *, const void *))
+ _GL_ARG_NONNULL ((1, 2, 3));
/* Searches an element in the tree *VROOTP that compares equal to KEY.
If one is found, it is removed from the tree, and its parent node is
returned. Otherwise, NULL is returned. */
extern void * tdelete (const void *key, void **vrootp,
- int (*compar) (const void *, const void *));
+ int (*compar) (const void *, const void *))
+ _GL_ARG_NONNULL ((1, 2, 3));
/* Perform a depth-first, left-to-right traversal of the tree VROOT.
The ACTION function is called:
2. an indicator which visit of the node this is,
3. the level of the node in the tree (0 for the root). */
extern void twalk (const void *vroot,
- void (*action) (const void *, VISIT, int));
+ void (*action) (const void *, VISIT, int))
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef tsearch
-# define tsearch(k,v,c) \
- (GL_LINK_WARNING ("tsearch is unportable - " \
- "use gnulib module tsearch for portability"), \
- tsearch (k, v, c))
+# if HAVE_RAW_DECL_TSEARCH
+_GL_WARN_ON_USE (tsearch, "tsearch is unportable - "
+ "use gnulib module tsearch for portability");
+# endif
# undef tfind
-# define tfind(k,v,c) \
- (GL_LINK_WARNING ("tfind is unportable - " \
- "use gnulib module tsearch for portability"), \
- tfind (k, v, c))
+# if HAVE_RAW_DECL_TFIND
+_GL_WARN_ON_USE (tfind, "tfind is unportable - "
+ "use gnulib module tsearch for portability");
+# endif
# undef tdelete
-# define tdelete(k,v,c) \
- (GL_LINK_WARNING ("tdelete is unportable - " \
- "use gnulib module tsearch for portability"), \
- tdelete (k, v, c))
+# if HAVE_RAW_DECL_TDELETE
+_GL_WARN_ON_USE (tdelete, "tdelete is unportable - "
+ "use gnulib module tsearch for portability");
+# endif
# undef twalk
-# define twalk(v,a) \
- (GL_LINK_WARNING ("twalk is unportable - " \
- "use gnulib module tsearch for portability"), \
- twalk (v, a))
+# if HAVE_RAW_DECL_TWALK
+_GL_WARN_ON_USE (twalk, "twalk is unportable - "
+ "use gnulib module tsearch for portability");
+# endif
#endif