[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4222-g02b89f5
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4222-g02b89f5 |
Date: |
Sun, 25 Apr 2021 03:27:33 -0400 (EDT) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-5.1-stable has been updated
via 02b89f57ae213a99c48d59d3cc8cf0c91a94cacf (commit)
from 0519026ef48de70430138f4b5faff13768ea7353 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=02b89f57ae213a99c48d59d3cc8cf0c91a94cacf
commit 02b89f57ae213a99c48d59d3cc8cf0c91a94cacf
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sun Apr 25 10:27:04 2021 +0300
More gnulib files to avoid glibc private interfaces.
diff --git a/support/ChangeLog b/support/ChangeLog
index 54f51fc..1efcbc0 100644
--- a/support/ChangeLog
+++ b/support/ChangeLog
@@ -1,3 +1,13 @@
+2021-04-25 Arnold D. Robbins <arnold@skeeve.com>
+
+ More of the same:
+
+ * Makefile.am (EXTRA_DIST): Add more files in malloc directory.
+ (libsupport_a_SOURCES): Add malloc/dynarray_finalize.c and
+ malloc/dynarray_emplace_enlarge.c.
+ * malloc/dynarray_finalize.c, malloc/dynarray_emplace_enlarge.c:
+ New files, from GNULIB.
+
2021-04-22 Arnold D. Robbins <arnold@skeeve.com>
* dynarray.h: Don't redefine libc interfaces to gnulib
diff --git a/support/Makefile.am b/support/Makefile.am
index 8aba807..028dbe4 100644
--- a/support/Makefile.am
+++ b/support/Makefile.am
@@ -59,7 +59,9 @@ libsupport_a_SOURCES = \
regex.h \
verify.h \
xalloc.h \
- malloc/dynarray_resize.c
+ malloc/dynarray_resize.c \
+ malloc/dynarray_emplace_enlarge.c \
+ malloc/dynarray_finalize.c
# For some make's, e.g. OpenBSD, that don't define this
RM = rm -f
diff --git a/support/Makefile.in b/support/Makefile.in
index 810a887..7106b5f 100644
--- a/support/Makefile.in
+++ b/support/Makefile.in
@@ -142,7 +142,8 @@ libsupport_a_AR = $(AR) $(ARFLAGS)
libsupport_a_LIBADD =
am_libsupport_a_OBJECTS = dfa.$(OBJEXT) getopt.$(OBJEXT) \
getopt1.$(OBJEXT) localeinfo.$(OBJEXT) random.$(OBJEXT) \
- regex.$(OBJEXT) dynarray_resize.$(OBJEXT)
+ regex.$(OBJEXT) dynarray_resize.$(OBJEXT) \
+ dynarray_emplace_enlarge.$(OBJEXT) dynarray_finalize.$(OBJEXT)
libsupport_a_OBJECTS = $(am_libsupport_a_OBJECTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -160,6 +161,8 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/dfa.Po \
+ ./$(DEPDIR)/dynarray_emplace_enlarge.Po \
+ ./$(DEPDIR)/dynarray_finalize.Po \
./$(DEPDIR)/dynarray_resize.Po ./$(DEPDIR)/getopt.Po \
./$(DEPDIR)/getopt1.Po ./$(DEPDIR)/localeinfo.Po \
./$(DEPDIR)/random.Po ./$(DEPDIR)/regex.Po
@@ -378,7 +381,9 @@ libsupport_a_SOURCES = \
regex.h \
verify.h \
xalloc.h \
- malloc/dynarray_resize.c
+ malloc/dynarray_resize.c \
+ malloc/dynarray_emplace_enlarge.c \
+ malloc/dynarray_finalize.c
# For some make's, e.g. OpenBSD, that don't define this
@@ -432,6 +437,8 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfa.Po@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/dynarray_emplace_enlarge.Po@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/dynarray_finalize.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynarray_resize.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ #
am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ #
am--include-marker
@@ -473,6 +480,34 @@ dynarray_resize.obj: malloc/dynarray_resize.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE)
$(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o
dynarray_resize.obj `if test -f 'malloc/dynarray_resize.c'; then $(CYGPATH_W)
'malloc/dynarray_resize.c'; else $(CYGPATH_W)
'$(srcdir)/malloc/dynarray_resize.c'; fi`
+dynarray_emplace_enlarge.o: malloc/dynarray_emplace_enlarge.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT
dynarray_emplace_enlarge.o -MD -MP -MF $(DEPDIR)/dynarray_emplace_enlarge.Tpo
-c -o dynarray_emplace_enlarge.o `test -f 'malloc/dynarray_emplace_enlarge.c'
|| echo '$(srcdir)/'`malloc/dynarray_emplace_enlarge.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
$(DEPDIR)/dynarray_emplace_enlarge.Tpo $(DEPDIR)/dynarray_emplace_enlarge.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@
$(AM_V_CC)source='malloc/dynarray_emplace_enlarge.c'
object='dynarray_emplace_enlarge.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE)
$(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o
dynarray_emplace_enlarge.o `test -f 'malloc/dynarray_emplace_enlarge.c' || echo
'$(srcdir)/'`malloc/dynarray_emplace_enlarge.c
+
+dynarray_emplace_enlarge.obj: malloc/dynarray_emplace_enlarge.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT
dynarray_emplace_enlarge.obj -MD -MP -MF $(DEPDIR)/dynarray_emplace_enlarge.Tpo
-c -o dynarray_emplace_enlarge.obj `if test -f
'malloc/dynarray_emplace_enlarge.c'; then $(CYGPATH_W)
'malloc/dynarray_emplace_enlarge.c'; else $(CYGPATH_W)
'$(srcdir)/malloc/dynarray_emplace_enlarge.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
$(DEPDIR)/dynarray_emplace_enlarge.Tpo $(DEPDIR)/dynarray_emplace_enlarge.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@
$(AM_V_CC)source='malloc/dynarray_emplace_enlarge.c'
object='dynarray_emplace_enlarge.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE)
$(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o
dynarray_emplace_enlarge.obj `if test -f 'malloc/dynarray_emplace_enlarge.c';
then $(CYGPATH_W) 'malloc/dynarray_emplace_enlarge.c'; else $(CYGPATH_W)
'$(srcdir)/malloc/dynarray_emplace_enlarge.c'; fi`
+
+dynarray_finalize.o: malloc/dynarray_finalize.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dynarray_finalize.o -MD
-MP -MF $(DEPDIR)/dynarray_finalize.Tpo -c -o dynarray_finalize.o `test -f
'malloc/dynarray_finalize.c' || echo '$(srcdir)/'`malloc/dynarray_finalize.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dynarray_finalize.Tpo
$(DEPDIR)/dynarray_finalize.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@
$(AM_V_CC)source='malloc/dynarray_finalize.c' object='dynarray_finalize.o'
libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE)
$(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o
dynarray_finalize.o `test -f 'malloc/dynarray_finalize.c' || echo
'$(srcdir)/'`malloc/dynarray_finalize.c
+
+dynarray_finalize.obj: malloc/dynarray_finalize.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dynarray_finalize.obj -MD
-MP -MF $(DEPDIR)/dynarray_finalize.Tpo -c -o dynarray_finalize.obj `if test -f
'malloc/dynarray_finalize.c'; then $(CYGPATH_W) 'malloc/dynarray_finalize.c';
else $(CYGPATH_W) '$(srcdir)/malloc/dynarray_finalize.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dynarray_finalize.Tpo
$(DEPDIR)/dynarray_finalize.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@
$(AM_V_CC)source='malloc/dynarray_finalize.c' object='dynarray_finalize.obj'
libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE)
$(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o
dynarray_finalize.obj `if test -f 'malloc/dynarray_finalize.c'; then
$(CYGPATH_W) 'malloc/dynarray_finalize.c'; else $(CYGPATH_W)
'$(srcdir)/malloc/dynarray_finalize.c'; fi`
+
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
@@ -598,6 +633,8 @@ clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -f ./$(DEPDIR)/dfa.Po
+ -rm -f ./$(DEPDIR)/dynarray_emplace_enlarge.Po
+ -rm -f ./$(DEPDIR)/dynarray_finalize.Po
-rm -f ./$(DEPDIR)/dynarray_resize.Po
-rm -f ./$(DEPDIR)/getopt.Po
-rm -f ./$(DEPDIR)/getopt1.Po
@@ -650,6 +687,8 @@ installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/dfa.Po
+ -rm -f ./$(DEPDIR)/dynarray_emplace_enlarge.Po
+ -rm -f ./$(DEPDIR)/dynarray_finalize.Po
-rm -f ./$(DEPDIR)/dynarray_resize.Po
-rm -f ./$(DEPDIR)/getopt.Po
-rm -f ./$(DEPDIR)/getopt1.Po
diff --git a/support/malloc/dynarray_emplace_enlarge.c
b/support/malloc/dynarray_emplace_enlarge.c
new file mode 100644
index 0000000..0f8baf9
--- /dev/null
+++ b/support/malloc/dynarray_emplace_enlarge.c
@@ -0,0 +1,77 @@
+/* Increase the size of a dynamic array in preparation of an emplace operation.
+ Copyright (C) 2017-2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+#include <dynarray.h>
+#include <errno.h>
+#include <intprops.h>
+#include <stdlib.h>
+#include <string.h>
+
+bool
+__libc_dynarray_emplace_enlarge (struct dynarray_header *list,
+ void *scratch, size_t element_size)
+{
+ size_t new_allocated;
+ if (list->allocated == 0)
+ {
+ /* No scratch buffer provided. Choose a reasonable default
+ size. */
+ if (element_size < 4)
+ new_allocated = 16;
+ else if (element_size < 8)
+ new_allocated = 8;
+ else
+ new_allocated = 4;
+ }
+ else
+ /* Increase the allocated size, using an exponential growth
+ policy. */
+ {
+ new_allocated = list->allocated + list->allocated / 2 + 1;
+ if (new_allocated <= list->allocated)
+ {
+ /* Overflow. */
+ __set_errno (ENOMEM);
+ return false;
+ }
+ }
+
+ size_t new_size;
+ if (INT_MULTIPLY_WRAPV (new_allocated, element_size, &new_size))
+ return false;
+ void *new_array;
+ if (list->array == scratch)
+ {
+ /* The previous array was not heap-allocated. */
+ new_array = malloc (new_size);
+ if (new_array != NULL && list->array != NULL)
+ memcpy (new_array, list->array, list->used * element_size);
+ }
+ else
+ new_array = realloc (list->array, new_size);
+ if (new_array == NULL)
+ return false;
+ list->array = new_array;
+ list->allocated = new_allocated;
+ return true;
+}
+libc_hidden_def (__libc_dynarray_emplace_enlarge)
diff --git a/support/malloc/dynarray_finalize.c
b/support/malloc/dynarray_finalize.c
new file mode 100644
index 0000000..c33da41
--- /dev/null
+++ b/support/malloc/dynarray_finalize.c
@@ -0,0 +1,66 @@
+/* Copy the dynamically-allocated area to an explicitly-sized heap allocation.
+ Copyright (C) 2017-2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+#include <dynarray.h>
+#include <stdlib.h>
+#include <string.h>
+
+bool
+__libc_dynarray_finalize (struct dynarray_header *list,
+ void *scratch, size_t element_size,
+ struct dynarray_finalize_result *result)
+{
+ if (__dynarray_error (list))
+ /* The caller will reported the deferred error. */
+ return false;
+
+ size_t used = list->used;
+
+ /* Empty list. */
+ if (used == 0)
+ {
+ /* An empty list could still be backed by a heap-allocated
+ array. Free it if necessary. */
+ if (list->array != scratch)
+ free (list->array);
+ *result = (struct dynarray_finalize_result) { NULL, 0 };
+ return true;
+ }
+
+ size_t allocation_size = used * element_size;
+ void *heap_array = malloc (allocation_size);
+ if (heap_array != NULL)
+ {
+ /* The new array takes ownership of the strings. */
+ if (list->array != NULL)
+ memcpy (heap_array, list->array, allocation_size);
+ if (list->array != scratch)
+ free (list->array);
+ *result = (struct dynarray_finalize_result)
+ { .array = heap_array, .length = used };
+ return true;
+ }
+ else
+ /* The caller will perform the freeing operation. */
+ return false;
+}
+libc_hidden_def (__libc_dynarray_finalize)
-----------------------------------------------------------------------
Summary of changes:
support/ChangeLog | 10 ++++
support/Makefile.am | 4 +-
support/Makefile.in | 43 +++++++++++++-
...ynarray_resize.c => dynarray_emplace_enlarge.c} | 53 +++++++++--------
support/malloc/dynarray_finalize.c | 66 ++++++++++++++++++++++
5 files changed, 151 insertions(+), 25 deletions(-)
copy support/malloc/{dynarray_resize.c => dynarray_emplace_enlarge.c} (54%)
create mode 100644 support/malloc/dynarray_finalize.c
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4222-g02b89f5,
Arnold Robbins <=