Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: autotools/gnulib/malloc/, autotools/m4/, autotools/gnulib/, /
Date: Sun, 27 Feb 2022 10:43:34
Message-Id: 1645958565.2a9ab33940b301a572dc12f817d2c66161bfd9bc.grobian@gentoo
1 commit: 2a9ab33940b301a572dc12f817d2c66161bfd9bc
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sun Feb 27 10:42:45 2022 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sun Feb 27 10:42:45 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=2a9ab339
7
8 buildsys: attempt to fix Linux build
9
10 import basename-lgpl which doesn't exist or something in linux builds,
11 pretty odd
12
13 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
14
15 autogen.sh | 1 +
16 autotools/gnulib/Makefile.am | 1 +
17 autotools/gnulib/Makefile.in | 1 +
18 autotools/gnulib/malloc/.dirstamp | 0
19 autotools/gnulib/malloc/scratch_buffer.gl.h | 148 ----------------------------
20 autotools/m4/gnulib-cache.m4 | 2 +
21 6 files changed, 5 insertions(+), 148 deletions(-)
22
23 diff --git a/autogen.sh b/autogen.sh
24 index ea564e0..75645de 100755
25 --- a/autogen.sh
26 +++ b/autogen.sh
27 @@ -28,6 +28,7 @@ done
28 # reload the gnulib code
29 PATH=/usr/local/src/gnu/gnulib:${PATH}
30 mods="
31 + basename-lgpl
32 dirent
33 faccessat
34 fdopendir
35
36 diff --git a/autotools/gnulib/Makefile.am b/autotools/gnulib/Makefile.am
37 index 75a456f..dd83446 100644
38 --- a/autotools/gnulib/Makefile.am
39 +++ b/autotools/gnulib/Makefile.am
40 @@ -33,6 +33,7 @@
41 # --no-libtool \
42 # --macro-prefix=gl \
43 # --no-vc-files \
44 +# basename-lgpl \
45 # dirent \
46 # faccessat \
47 # fdopendir \
48
49 diff --git a/autotools/gnulib/Makefile.in b/autotools/gnulib/Makefile.in
50 index 0a271a7..78592fa 100644
51 --- a/autotools/gnulib/Makefile.in
52 +++ b/autotools/gnulib/Makefile.in
53 @@ -47,6 +47,7 @@
54 # --no-libtool \
55 # --macro-prefix=gl \
56 # --no-vc-files \
57 +# basename-lgpl \
58 # dirent \
59 # faccessat \
60 # fdopendir \
61
62 diff --git a/autotools/gnulib/malloc/.dirstamp b/autotools/gnulib/malloc/.dirstamp
63 deleted file mode 100644
64 index e69de29..0000000
65
66 diff --git a/autotools/gnulib/malloc/scratch_buffer.gl.h b/autotools/gnulib/malloc/scratch_buffer.gl.h
67 deleted file mode 100644
68 index 3de567c..0000000
69 --- a/autotools/gnulib/malloc/scratch_buffer.gl.h
70 +++ /dev/null
71 @@ -1,148 +0,0 @@
72 -/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
73 -/* Variable-sized buffer with on-stack default allocation.
74 - Copyright (C) 2015-2022 Free Software Foundation, Inc.
75 - This file is part of the GNU C Library.
76 -
77 - The GNU C Library is free software; you can redistribute it and/or
78 - modify it under the terms of the GNU Lesser General Public
79 - License as published by the Free Software Foundation; either
80 - version 2.1 of the License, or (at your option) any later version.
81 -
82 - The GNU C Library is distributed in the hope that it will be useful,
83 - but WITHOUT ANY WARRANTY; without even the implied warranty of
84 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
85 - Lesser General Public License for more details.
86 -
87 - You should have received a copy of the GNU Lesser General Public
88 - License along with the GNU C Library; if not, see
89 - <https://www.gnu.org/licenses/>. */
90 -
91 -#ifndef _SCRATCH_BUFFER_H
92 -#define _SCRATCH_BUFFER_H
93 -
94 -/* Scratch buffers with a default stack allocation and fallback to
95 - heap allocation. It is expected that this function is used in this
96 - way:
97 -
98 - struct scratch_buffer tmpbuf;
99 - scratch_buffer_init (&tmpbuf);
100 -
101 - while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length))
102 - if (!scratch_buffer_grow (&tmpbuf))
103 - return -1;
104 -
105 - scratch_buffer_free (&tmpbuf);
106 - return 0;
107 -
108 - The allocation functions (scratch_buffer_grow,
109 - scratch_buffer_grow_preserve, scratch_buffer_set_array_size) make
110 - sure that the heap allocation, if any, is freed, so that the code
111 - above does not have a memory leak. The buffer still remains in a
112 - state that can be deallocated using scratch_buffer_free, so a loop
113 - like this is valid as well:
114 -
115 - struct scratch_buffer tmpbuf;
116 - scratch_buffer_init (&tmpbuf);
117 -
118 - while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length))
119 - if (!scratch_buffer_grow (&tmpbuf))
120 - break;
121 -
122 - scratch_buffer_free (&tmpbuf);
123 -
124 - scratch_buffer_grow and scratch_buffer_grow_preserve are guaranteed
125 - to grow the buffer by at least 512 bytes. This means that when
126 - using the scratch buffer as a backing store for a non-character
127 - array whose element size, in bytes, is 512 or smaller, the scratch
128 - buffer only has to grow once to make room for at least one more
129 - element.
130 -*/
131 -
132 -#include <stdbool.h>
133 -#include <stddef.h>
134 -#include <stdlib.h>
135 -
136 -/* Scratch buffer. Must be initialized with scratch_buffer_init
137 - before its use. */
138 -struct scratch_buffer {
139 - void *data; /* Pointer to the beginning of the scratch area. */
140 - size_t length; /* Allocated space at the data pointer, in bytes. */
141 - union { max_align_t __align; char __c[1024]; } __space;
142 -};
143 -
144 -/* Initializes *BUFFER so that BUFFER->data points to BUFFER->__space
145 - and BUFFER->length reflects the available space. */
146 -static inline void
147 -scratch_buffer_init (struct scratch_buffer *buffer)
148 -{
149 - buffer->data = buffer->__space.__c;
150 - buffer->length = sizeof (buffer->__space);
151 -}
152 -
153 -/* Deallocates *BUFFER (if it was heap-allocated). */
154 -static inline void
155 -scratch_buffer_free (struct scratch_buffer *buffer)
156 -{
157 - if (buffer->data != buffer->__space.__c)
158 - free (buffer->data);
159 -}
160 -
161 -/* Grow *BUFFER by some arbitrary amount. The buffer contents is NOT
162 - preserved. Return true on success, false on allocation failure (in
163 - which case the old buffer is freed). On success, the new buffer is
164 - larger than the previous size. On failure, *BUFFER is deallocated,
165 - but remains in a free-able state, and errno is set. */
166 -bool __libc_scratch_buffer_grow (struct scratch_buffer *buffer);
167 -
168 -/* Alias for __libc_scratch_buffer_grow. */
169 -static inline _GL_ATTRIBUTE_ALWAYS_INLINE bool
170 -scratch_buffer_grow (struct scratch_buffer *buffer)
171 -{
172 - return _GL_LIKELY (__libc_scratch_buffer_grow (buffer));
173 -}
174 -
175 -/* Like __libc_scratch_buffer_grow, but preserve the old buffer
176 - contents on success, as a prefix of the new buffer. */
177 -bool __libc_scratch_buffer_grow_preserve (struct scratch_buffer *buffer);
178 -
179 -/* Alias for __libc_scratch_buffer_grow_preserve. */
180 -static inline _GL_ATTRIBUTE_ALWAYS_INLINE bool
181 -scratch_buffer_grow_preserve (struct scratch_buffer *buffer)
182 -{
183 - return _GL_LIKELY (__libc_scratch_buffer_grow_preserve (buffer));
184 -}
185 -
186 -/* Grow *BUFFER so that it can store at least NELEM elements of SIZE
187 - bytes. The buffer contents are NOT preserved. Both NELEM and SIZE
188 - can be zero. Return true on success, false on allocation failure
189 - (in which case the old buffer is freed, but *BUFFER remains in a
190 - free-able state, and errno is set). It is unspecified whether this
191 - function can reduce the array size. */
192 -bool __libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer,
193 - size_t nelem, size_t size);
194 -
195 -/* Alias for __libc_scratch_set_array_size. */
196 -static inline _GL_ATTRIBUTE_ALWAYS_INLINE bool
197 -scratch_buffer_set_array_size (struct scratch_buffer *buffer,
198 - size_t nelem, size_t size)
199 -{
200 - return _GL_LIKELY (__libc_scratch_buffer_set_array_size
201 - (buffer, nelem, size));
202 -}
203 -
204 -/* Return a copy of *BUFFER's first SIZE bytes as a heap-allocated block,
205 - deallocating *BUFFER if it was heap-allocated. SIZE must be at
206 - most *BUFFER's size. Return NULL (setting errno) on memory
207 - exhaustion. */
208 -void *__libc_scratch_buffer_dupfree (struct scratch_buffer *buffer,
209 - size_t size);
210 -
211 -/* Alias for __libc_scratch_dupfree. */
212 -static inline _GL_ATTRIBUTE_ALWAYS_INLINE void *
213 -scratch_buffer_dupfree (struct scratch_buffer *buffer, size_t size)
214 -{
215 - void *r = __libc_scratch_buffer_dupfree (buffer, size);
216 - return _GL_LIKELY (r != NULL) ? r : NULL;
217 -}
218 -
219 -#endif /* _SCRATCH_BUFFER_H */
220
221 diff --git a/autotools/m4/gnulib-cache.m4 b/autotools/m4/gnulib-cache.m4
222 index fed003e..9d1337e 100644
223 --- a/autotools/m4/gnulib-cache.m4
224 +++ b/autotools/m4/gnulib-cache.m4
225 @@ -38,6 +38,7 @@
226 # --no-libtool \
227 # --macro-prefix=gl \
228 # --no-vc-files \
229 +# basename-lgpl \
230 # dirent \
231 # faccessat \
232 # fdopendir \
233 @@ -63,6 +64,7 @@
234 # Specification in the form of a few gnulib-tool.m4 macro invocations:
235 gl_LOCAL_DIR([])
236 gl_MODULES([
237 + basename-lgpl
238 dirent
239 faccessat
240 fdopendir