annotate lib/gl_xlist.h @ 40231:9b3c79fdfe0b

strtod: fix clash with strtold Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817). * lib/strtod.c (compute_minus_zero, minus_zero): Simplify by remving the macro / external variable, and having just a function. User changed. This avoids the need for an external variable that might clash.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 11 Mar 2019 16:40:29 -0700
parents b06060465f09
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Abstract sequential list data type, with out-of-memory checking.
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
2 Copyright (C) 2009-2019 Free Software Foundation, Inc.
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 Written by Bruno Haible <bruno@clisp.org>, 2009.
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 (at your option) any later version.
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
19190
9759915b2aca all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 18626
diff changeset
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #ifndef _GL_XLIST_H
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #define _GL_XLIST_H
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include "gl_list.h"
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 #include "xalloc.h"
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23
17473
1f9070ef79b0 headers: check that _GL_INLINE_HEADER_BEGIN is defined
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
24 #ifndef _GL_INLINE_HEADER_BEGIN
1f9070ef79b0 headers: check that _GL_INLINE_HEADER_BEGIN is defined
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
25 #error "Please include config.h first."
1f9070ef79b0 headers: check that _GL_INLINE_HEADER_BEGIN is defined
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
26 #endif
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
27 _GL_INLINE_HEADER_BEGIN
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
28 #ifndef GL_XLIST_INLINE
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
29 # define GL_XLIST_INLINE _GL_INLINE
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
30 #endif
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
31
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 #ifdef __cplusplus
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 extern "C" {
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 #endif
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 /* These functions are thin wrappers around the corresponding functions with
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 _nx_ infix from gl_list.h. Upon out-of-memory, they invoke xalloc_die (),
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 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
39 #if 0 /* These are defined inline below. */
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 extern gl_list_t gl_list_create_empty (gl_list_implementation_t implementation,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 gl_listelement_equals_fn equals_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 gl_listelement_hashcode_fn hashcode_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 gl_listelement_dispose_fn dispose_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 bool allow_duplicates);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 extern gl_list_t gl_list_create (gl_list_implementation_t implementation,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 gl_listelement_equals_fn equals_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 gl_listelement_hashcode_fn hashcode_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 gl_listelement_dispose_fn dispose_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 bool allow_duplicates,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 size_t count, const void **contents);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 extern void gl_list_node_set_value (gl_list_t list, gl_list_node_t node,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 const void *elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 extern gl_list_node_t gl_list_set_at (gl_list_t list, size_t position,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 const void *elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 extern gl_list_node_t gl_list_add_first (gl_list_t list, const void *elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 extern gl_list_node_t gl_list_add_last (gl_list_t list, const void *elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 extern gl_list_node_t gl_list_add_before (gl_list_t list, gl_list_node_t node,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 const void *elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 extern gl_list_node_t gl_list_add_after (gl_list_t list, gl_list_node_t node,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 const void *elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 extern gl_list_node_t gl_list_add_at (gl_list_t list, size_t position,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 const void *elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 extern gl_list_node_t gl_sortedlist_add (gl_list_t list,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 gl_listelement_compar_fn compar,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 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
66 #endif
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
68 GL_XLIST_INLINE gl_list_t
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 gl_list_create_empty (gl_list_implementation_t implementation,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 gl_listelement_equals_fn equals_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 gl_listelement_hashcode_fn hashcode_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 gl_listelement_dispose_fn dispose_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 bool allow_duplicates)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 {
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75 gl_list_t result =
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 gl_list_nx_create_empty (implementation, equals_fn, hashcode_fn, dispose_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 allow_duplicates);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 if (result == NULL)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 xalloc_die ();
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 return result;
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 }
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
82
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
83 GL_XLIST_INLINE gl_list_t
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
84 gl_list_create (gl_list_implementation_t implementation,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 gl_listelement_equals_fn equals_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86 gl_listelement_hashcode_fn hashcode_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87 gl_listelement_dispose_fn dispose_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88 bool allow_duplicates,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 size_t count, const void **contents)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 {
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 gl_list_t result =
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 gl_list_nx_create (implementation, equals_fn, hashcode_fn, dispose_fn,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 allow_duplicates, count, contents);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 if (result == NULL)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 xalloc_die ();
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96 return result;
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 }
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
98
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
99 GL_XLIST_INLINE void
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 gl_list_node_set_value (gl_list_t list, gl_list_node_t node, const void *elt)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 {
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
102 int result = gl_list_node_nx_set_value (list, node, elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 if (result < 0)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
104 xalloc_die ();
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 }
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
107 GL_XLIST_INLINE gl_list_node_t
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
108 gl_list_set_at (gl_list_t list, size_t position, const void *elt)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
109 {
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
110 gl_list_node_t result = gl_list_nx_set_at (list, position, elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
111 if (result == NULL)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
112 xalloc_die ();
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
113 return result;
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114 }
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
115
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
116 GL_XLIST_INLINE gl_list_node_t
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 gl_list_add_first (gl_list_t list, const void *elt)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
118 {
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
119 gl_list_node_t result = gl_list_nx_add_first (list, elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120 if (result == NULL)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
121 xalloc_die ();
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
122 return result;
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
123 }
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
125 GL_XLIST_INLINE gl_list_node_t
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 gl_list_add_last (gl_list_t list, const void *elt)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
127 {
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
128 gl_list_node_t result = gl_list_nx_add_last (list, elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129 if (result == NULL)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 xalloc_die ();
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
131 return result;
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
132 }
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
134 GL_XLIST_INLINE gl_list_node_t
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
135 gl_list_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136 {
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
137 gl_list_node_t result = gl_list_nx_add_before (list, node, elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
138 if (result == NULL)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
139 xalloc_die ();
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
140 return result;
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
141 }
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
142
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
143 GL_XLIST_INLINE gl_list_node_t
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
144 gl_list_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
145 {
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
146 gl_list_node_t result = gl_list_nx_add_after (list, node, elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
147 if (result == NULL)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
148 xalloc_die ();
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
149 return result;
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
150 }
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
151
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
152 GL_XLIST_INLINE gl_list_node_t
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
153 gl_list_add_at (gl_list_t list, size_t position, const void *elt)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
154 {
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
155 gl_list_node_t result = gl_list_nx_add_at (list, position, elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
156 if (result == NULL)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
157 xalloc_die ();
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
158 return result;
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
159 }
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
160
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
161 GL_XLIST_INLINE gl_list_node_t
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
162 gl_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
163 const void *elt)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
164 {
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
165 gl_list_node_t result = gl_sortedlist_nx_add (list, compar, elt);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
166 if (result == NULL)
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
167 xalloc_die ();
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
168 return result;
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
169 }
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
170
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
171 #ifdef __cplusplus
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
172 }
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
173 #endif
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
174
17178
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
175 _GL_INLINE_HEADER_END
86c983ca0522 list, oset, xlist, xoset, xsublist: simplify via extern inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
176
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
177 #endif /* _GL_XLIST_H */