annotate lib/gl_xoset.h @ 17363:5a51fb7777a9

sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin Problem reported by Marco Atzeri in <http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00000.html>. * lib/sys_select.in.h [HAVE_SYS_SELECT_H && _CYGWIN_SYS_TIME_H]: Simply delegate to the system <sys/select.h> in this case too. Also, pay attention to _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H only if OSF/1, since otherwise Cygwin breaks, and it doesn't seem to be needed on Solaris either. * lib/sys_time.in.h [_CYGWIN_SYS_TIME_H]: Simply delgate to the system <sys/time.h> in this case.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 19 Mar 2013 09:08:47 -0700
parents e542fd46ad6f
children 1f9070ef79b0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12444
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Abstract ordered set data type, with out-of-memory checking.
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 17198
diff changeset
2 Copyright (C) 2009-2013 Free Software Foundation, Inc.
12444
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 Written by Bruno Haible <bruno@clisp.org>, 2009.
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 (at your option) any later version.
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #ifndef _GL_XOSET_H
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #define _GL_XOSET_H
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include "gl_oset.h"
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 #include "xalloc.h"
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
24 _GL_INLINE_HEADER_BEGIN
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
25 #ifndef GL_XOSET_INLINE
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
26 # define GL_XOSET_INLINE _GL_INLINE
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
27 #endif
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
28
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
29
12444
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 #ifdef __cplusplus
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 extern "C" {
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 #endif
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 /* These functions are thin wrappers around the corresponding functions with
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 _nx_ infix from gl_oset.h. Upon out-of-memory, they invoke xalloc_die (),
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 instead of returning an error indicator. */
17198
8bfb14044fbb list, oset, xlist, xoset: fix extern inline issue with C99
Paul Eggert <eggert@cs.ucla.edu>
parents: 17178
diff changeset
37 #if 0 /* These are defined inline below. */
12444
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 extern gl_oset_t gl_oset_create_empty (gl_oset_implementation_t implementation,
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 gl_setelement_compar_fn compar_fn,
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 gl_setelement_dispose_fn dispose_fn);
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 extern bool gl_oset_add (gl_oset_t set, const void *elt);
17198
8bfb14044fbb list, oset, xlist, xoset: fix extern inline issue with C99
Paul Eggert <eggert@cs.ucla.edu>
parents: 17178
diff changeset
42 #endif
12444
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
44 GL_XOSET_INLINE gl_oset_t
12444
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 gl_oset_create_empty (gl_oset_implementation_t implementation,
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 gl_setelement_compar_fn compar_fn,
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 gl_setelement_dispose_fn dispose_fn)
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 {
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 gl_oset_t result =
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 gl_oset_nx_create_empty (implementation, compar_fn, dispose_fn);
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 if (result == NULL)
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 xalloc_die ();
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 return result;
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 }
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
56 GL_XOSET_INLINE bool
12444
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 gl_oset_add (gl_oset_t set, const void *elt)
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 {
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 int result = gl_oset_nx_add (set, elt);
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 if (result < 0)
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 xalloc_die ();
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 return result;
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 }
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 #ifdef __cplusplus
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 }
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67 #endif
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
69 _GL_INLINE_HEADER_END
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
70
12444
29d240cb21b2 Move the malloc checking from module 'oset' to new module 'xoset'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 #endif /* _GL_XOSET_H */