1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-23 10:29:58 +01:00
gnupg/intl/tsearch.h

84 lines
2.8 KiB
C
Raw Normal View History

gettext: Upgrade to version 0.18 * configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.18. * po/Makefile.in.in: Upgrade to gettext-0.18. Keep option --previous of msgmerge. * intl/: Upgrade to gettext-0.18. * m4/gettext.m4: Upgrade to gettext-0.18.1. * m4/iconv.m4: Upgrade to gettext-0.18.1. * m4/lib-ld.m4: Upgrade to gettext-0.18.1. * m4/lib-link.m4: Upgrade to gettext-0.18.1. * m4/lib-prefix.m4: Upgrade to gettext-0.18.1. * m4/nls.m4: Upgrade to gettext-0.18.1. * m4/po.m4: Upgrade to gettext-0.18.1. * m4/progtest.m4: Upgrade to gettext-0.18.1. * m4/codeset.m4: Upgrade to gettext-0.18.1. * m4/fcntl-o.m4: New file, from gettext-0.18.1. * m4/glibc2.m4: Upgrade to gettext-0.18.1. * m4/glibc21.m4: Upgrade to gettext-0.18.1. * m4/intdiv0.m4: Upgrade to gettext-0.18.1. * m4/intl.m4: Upgrade to gettext-0.18.1. * m4/intldir.m4: Upgrade to gettext-0.18.1. * m4/intlmacosx.m4: Upgrade to gettext-0.18.1. * m4/intmax.m4: Upgrade to gettext-0.18.1. * m4/inttypes_h.m4: Upgrade to gettext-0.18.1. * m4/inttypes-pri.m4: Upgrade to gettext-0.18.1. * m4/lcmessage.m4: Upgrade to gettext-0.18.1. * m4/lock.m4: Upgrade to gettext-0.18.1. * m4/longlong.m4: Upgrade to gettext-0.18.1. * m4/printf-posix.m4: Upgrade to gettext-0.18.1. * m4/size_max.m4: Upgrade to gettext-0.18.1. * m4/stdint_h.m4: Upgrade to gettext-0.18.1. * m4/threadlib.m4: New file, from gettext-0.18.1. * m4/uintmax_t.m4: Upgrade to gettext-0.18.1. * m4/visibility.m4: Upgrade to gettext-0.18.1. * m4/wchar_t.m4: Upgrade to gettext-0.18.1. * m4/wint_t.m4: Upgrade to gettext-0.18.1. * m4/xsize.m4: Upgrade to gettext-0.18.1. * m4/Makefile.am (EXTRA_DIST): Add the new files.
2012-12-14 16:08:23 +01:00
/* Binary tree data structure.
Copyright (C) 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2, or (at your option)
any later version.
This program 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
#ifndef _TSEARCH_H
#define _TSEARCH_H
#if HAVE_TSEARCH
/* Get tseach(), tfind(), tdelete(), twalk() declarations. */
#include <search.h>
#else
#ifdef __cplusplus
extern "C" {
#endif
/* See <http://www.opengroup.org/susv3xbd/search.h.html>,
<http://www.opengroup.org/susv3xsh/tsearch.html>
for details. */
typedef enum
{
preorder,
postorder,
endorder,
leaf
}
VISIT;
/* Searches an element in the tree *VROOTP that compares equal to KEY.
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 *));
/* 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 *));
/* 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 *));
/* Perform a depth-first, left-to-right traversal of the tree VROOT.
The ACTION function is called:
- for non-leaf nodes: 3 times, before the left subtree traversal,
after the left subtree traversal but before the right subtree traversal,
and after the right subtree traversal,
- for leaf nodes: once.
The arguments passed to ACTION are:
1. the node; it can be casted to a 'const void * const *', i.e. into a
pointer to the key,
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));
#ifdef __cplusplus
}
#endif
#endif
#endif /* _TSEARCH_H */