From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.2 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 153C61F461 for ; Sun, 8 Sep 2019 05:15:29 +0000 (UTC) Received: from localhost ([::1]:47030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6pXr-0006vY-LM for normalperson@yhbt.net; Sun, 08 Sep 2019 01:15:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33586) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6pXn-0006ts-LS for bug-gnulib@gnu.org; Sun, 08 Sep 2019 01:15:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i6pXl-0003gr-Di for bug-gnulib@gnu.org; Sun, 08 Sep 2019 01:15:23 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:60942) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i6pXl-0003fV-56 for bug-gnulib@gnu.org; Sun, 08 Sep 2019 01:15:21 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 8F6481601BF for ; Sat, 7 Sep 2019 22:15:19 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id aFnW0Awg0zfK; Sat, 7 Sep 2019 22:15:18 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6A8A01600C2; Sat, 7 Sep 2019 22:15:18 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id QJVix0Gimyau; Sat, 7 Sep 2019 22:15:18 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 510C61600BF; Sat, 7 Sep 2019 22:15:18 -0700 (PDT) From: Paul Eggert To: bug-gnulib@gnu.org Subject: [PATCH] scratch_buffer: sync from glibc Date: Sat, 7 Sep 2019 22:15:13 -0700 Message-Id: <20190908051513.27719-1-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Eggert Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" * config/srclist.txt: Add the scratch_buffer source code from glibc, since these should be in sync. Autoupdate. --- ChangeLog | 7 +++++++ config/srclist.txt | 4 ++++ lib/malloc/scratch_buffer.h | 6 +++--- lib/malloc/scratch_buffer_grow_preserve.c | 4 ++-- lib/timegm.c | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e009db52..28a6b264b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2019-09-07 Paul Eggert + + scratch_buffer: sync from glibc + * config/srclist.txt: Add the scratch_buffer source + code from glibc, since these should be in sync. + Autoupdate. + 2019-09-07 Bruno Haible =20 doc: Update for glibc 2.30. diff --git a/config/srclist.txt b/config/srclist.txt index 6d37729ce..4a3a5a7af 100644 --- a/config/srclist.txt +++ b/config/srclist.txt @@ -46,6 +46,10 @@ $GNUORG Copyright/request-assign.future doc/Copyright $GNUORG Copyright/request-assign.program doc/Copyright $GNUORG Copyright/request-disclaim.changes doc/Copyright =20 +$LIBCSRC include/scratch_buffer.h lib/malloc +$LIBCSRC malloc/scratch_buffer_grow.c lib/malloc +$LIBCSRC malloc/scratch_buffer_grow_preserve.c lib/malloc +$LIBCSRC malloc/scratch_buffer_set_array_size.c lib/malloc # Temporarily newer in Gnulib than in glibc. #$LIBCSRC include/intprops.h lib $LIBCSRC posix/regcomp.c lib diff --git a/lib/malloc/scratch_buffer.h b/lib/malloc/scratch_buffer.h index f83e1004b..0482773ac 100644 --- a/lib/malloc/scratch_buffer.h +++ b/lib/malloc/scratch_buffer.h @@ -66,7 +66,7 @@ struct scratch_buffer { void *data; /* Pointer to the beginning of the scratch area. */ size_t length; /* Allocated space at the data pointer, in bytes. */ - max_align_t __space[(1023 + sizeof (max_align_t)) / sizeof (max_align_= t)]; + union { max_align_t __align; char __c[1024]; } __space; }; =20 /* Initializes *BUFFER so that BUFFER->data points to BUFFER->__space @@ -74,7 +74,7 @@ struct scratch_buffer { static inline void scratch_buffer_init (struct scratch_buffer *buffer) { - buffer->data =3D buffer->__space; + buffer->data =3D buffer->__space.__c; buffer->length =3D sizeof (buffer->__space); } =20 @@ -82,7 +82,7 @@ scratch_buffer_init (struct scratch_buffer *buffer) static inline void scratch_buffer_free (struct scratch_buffer *buffer) { - if (buffer->data !=3D buffer->__space) + if (buffer->data !=3D buffer->__space.__c) free (buffer->data); } =20 diff --git a/lib/malloc/scratch_buffer_grow_preserve.c b/lib/malloc/scrat= ch_buffer_grow_preserve.c index c3c6de18f..62fcc656b 100644 --- a/lib/malloc/scratch_buffer_grow_preserve.c +++ b/lib/malloc/scratch_buffer_grow_preserve.c @@ -30,14 +30,14 @@ __libc_scratch_buffer_grow_preserve (struct scratch_b= uffer *buffer) size_t new_length =3D 2 * buffer->length; void *new_ptr; =20 - if (buffer->data =3D=3D buffer->__space) + if (buffer->data =3D=3D buffer->__space.__c) { /* Move buffer to the heap. No overflow is possible because buffer->length describes a small buffer on the stack. */ new_ptr =3D malloc (new_length); if (new_ptr =3D=3D NULL) return false; - memcpy (new_ptr, buffer->__space, buffer->length); + memcpy (new_ptr, buffer->__space.__c, buffer->length); } else { diff --git a/lib/timegm.c b/lib/timegm.c index bae0ceee5..00854c796 100644 --- a/lib/timegm.c +++ b/lib/timegm.c @@ -15,7 +15,7 @@ =20 You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ =20 #ifndef _LIBC # include --=20 2.21.0