From patchwork Fri Oct 28 16:40:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 59587 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4E5903886C4A for ; Fri, 28 Oct 2022 16:41:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E5903886C4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666975299; bh=ThkY9eupWQ57fMPbpH12redPzowsUpiK06WPou54m9M=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=N4ZRATtRW+j4k9YBA42z8rn6ClaOQTEfyIXTPrHHxQdG/lRSFDBSsRDYWGevqyPep IBJ8dlMPRyZcTYDpsLzfdy0P8rAW0hAN2zD2SrrVJ9pjp0qO44DARtOO1YRc7l2FA5 aMAX/6QOrS62Qh3qXRoeL3z2L5wGyMvbCBuFT/1M= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2082.outbound.protection.outlook.com [40.107.20.82]) by sourceware.org (Postfix) with ESMTPS id 8C422383FBB5 for ; Fri, 28 Oct 2022 16:40:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8C422383FBB5 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=aiQUYUWmcW7vAr8N5gxZcMcJbQdESbXE2qTBeaWERLLDO0w+gXTUyADQ7HtGjrGI1tNwscreepRFhS7LyZrLjmjyghU581qV8681Zw4k/RCtPXwOQV5G0UYbb5mjZc0+pQSDJIo4BLbGKrPIy//KuBeSAbiW8G9XRR+VVf/sjgKyC6Lw5QgMiOcv2WFRIb+SLiIOVUYWEI9IGKEXvI1iS1TpR1kYx0AcP5Hzi5/FlA5EQNe+ltvsaFx6TSSkQWmxjuXfsAGEUXTc8JRCL9UqB0MqPgspKmey9oa7jAfkE25QBzW5cYzQvWjbxV1lTrBu8f529UQsysAARAeemV030g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ThkY9eupWQ57fMPbpH12redPzowsUpiK06WPou54m9M=; b=UNy6b0VgTUFxk9Owv063WQOdcGALaKVFnNKERVxIMg+GpuvXrueyEoiwMXmOZfhwkpPmZJJdqixP7gTOCl4L9wmrAJWUbeNxjXzwkynpueyX0nhR1LiTkD/cFcLfu745aYc4yMpQ/Mm9NkQqRzgQ50vUO2U4HYUWyV+A+DloJzXkrM/RP0XaYADokGym6d/PtM9GK2rR5E8D11ppN3KMfhX4u+4Rv2I9ORr2WKi6qYldNHEFLc/PAMbQVldZD2hH9FE6A+oKuOKnidTFJbHt0OtBujY01CahIryctnibMY6r23va3DOlnvsiRVmcLotXwlff95SJLJNbHelbZZVV/Q== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1, 1, smtp.mailfrom=arm.com] dmarc=[1, 1, header.from=arm.com]) Received: from DUZPR01CA0041.eurprd01.prod.exchangelabs.com (2603:10a6:10:468::19) by AS8PR08MB6519.eurprd08.prod.outlook.com (2603:10a6:20b:31c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15; Fri, 28 Oct 2022 16:40:33 +0000 Received: from DBAEUR03FT052.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:468:cafe::c9) by DUZPR01CA0041.outlook.office365.com (2603:10a6:10:468::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.23 via Frontend Transport; Fri, 28 Oct 2022 16:40:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT052.mail.protection.outlook.com (100.127.142.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14 via Frontend Transport; Fri, 28 Oct 2022 16:40:33 +0000 Received: ("Tessian outbound b4aebcc5bc64:v130"); Fri, 28 Oct 2022 16:40:33 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 5909ed89e53ffb1c X-CR-MTA-TID: 64aa7808 Received: from 9f1bd45d0a3b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B55DF354-1A51-414A-B4AA-CB19875ECD96.1; Fri, 28 Oct 2022 16:40:27 +0000 Received: from EUR02-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9f1bd45d0a3b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 28 Oct 2022 16:40:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H4Giy3W4BCDxlx/ESH1qzypa9b+SP5cxBol6GteMxQtl2BoLGuc1Vy1LYsFjHccitpbWCkRIhDPg7uO1xDyRiF+z1dpVhdaXHQdH6H8Og4X6w6EhGPM78v2Amw2RLi8H2PFo+jrj1oid7hlGuKCFlq0zg/efftkiQnIKI+ZnXTh79e+yVShAmCXBp2ys6R1eO/9ZlkHzpJoerBC9st+AcarYzciFS5pF6Sju2Wm3ZBcWPNYWEqL9Hx/5NXlgG6QuHZap4cWKqdCZxHScd6De2soxTNud1qDIGR8/oALe0YrUK23GF0TmjqAaPoLaNUn3oI4qCSTP0hCQhugvPvB/KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ThkY9eupWQ57fMPbpH12redPzowsUpiK06WPou54m9M=; b=fISrgCjIeYw+57Q+Mc1/WbE/3FQJWEglAYWwyWP5fN0T+MOf7v3wrYKndhK1AxXS3x48o/JHfzFNl6YaqoQf9oVIuqEdwPc9Zxmi+kB/BcZeLSUftRxXopdRC7pkZij03tassJYgsPbHTR1TGg9Fyvnn8l8G//KBXz6gGC3SHjuQvlz+B+uh1lmn/8e92gN4HayvUexDGbWXl/Y9wCAIJvPL8jeXWMISn5NFvbhcC7A5/OBRVxj4vXh/o5c7AzCyJKtFrUi32aQV31o8lU/45mQRUv4ytL5ur3iZKXZffk36JRAKWgJa/YboK/O1vlQQwp3dlefRoloDO4znwF13sA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AM6PR02CA0028.eurprd02.prod.outlook.com (2603:10a6:20b:6e::41) by DB9PR08MB6345.eurprd08.prod.outlook.com (2603:10a6:10:252::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14; Fri, 28 Oct 2022 16:40:16 +0000 Received: from AM7EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:6e:cafe::c5) by AM6PR02CA0028.outlook.office365.com (2603:10a6:20b:6e::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15 via Frontend Transport; Fri, 28 Oct 2022 16:40:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT041.mail.protection.outlook.com (100.127.140.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5723.32 via Frontend Transport; Fri, 28 Oct 2022 16:40:16 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 28 Oct 2022 16:40:15 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 28 Oct 2022 16:40:15 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 28 Oct 2022 16:40:15 +0000 To: Subject: [PATCH v2 4/4] Remove unused scratch_buffer_dupfree Date: Fri, 28 Oct 2022 17:40:15 +0100 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT041:EE_|DB9PR08MB6345:EE_|DBAEUR03FT052:EE_|AS8PR08MB6519:EE_ X-MS-Office365-Filtering-Correlation-Id: 0577e421-ac67-4754-b5a7-08dab9032236 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: r/9DE32jigA90UgySdJkBZl0dHh9OFlKWYCwMFzwiED8JTVpVEs+3tG+DD8gSACYTjwsO82qYZADBeafDJe8GopCGGFKJqlzwzQCGMYqz7yYC2wS8vE3Akiy1T5xQuZKdDxHy0f0mLGS3TPE0rj7zyrZJxmclrDLc5hhkWS0TkHiBHVbrJth0ENzNCgk3m8pSyW+fk64KaZ8vNQOKv40uBiecg3EGROdHpQ/X7t6OwzW2fIn9cVrDDduNbbqcPDfnmMfvvS8rbVTM1+kJIoQmKSdwdCFIWSKObGNCfzWCpuJbjWEF/0qUwMZtf7blFbZimOjovq5JNlF/bNVu5p0jZD4NiNxWhQ4bVHNRQVs1AkpIVooaXCiVQMJyzPdDR6XQk1q03CLTGZ1CLGecU4m2ieUDV/U+Xki020y7QiDTbd1U4Qo5Gg1LQJO9LRBHCT3nLLY7BVyKs9MesGdUR8Y7mCZjodmzTNMSlay9P0C/eifzI5lwcGIEx7a86tB/HqzIkQWxRug/EosWv4xhjz8q06iy5Pu0e8KGvIZeFEexNbDEWWDDhQRhuCZQgDWWLEY+da7qRjHlX5eytR+O4IHfVtkN+4qmoL1fW5C0gKIqGXLWPxMCQM9hlqJdLOPhrCJ96OhyYNgCl8ayiUzSmVIhp/LLLa7pIcD4pTujkMAiwKKVa0PAHkdag0oSiKjZo0y9s8US3nuqT/U7g/Pl1ykKs+oVH7dxup5KP/dQ+mccr4Vm2L8cgfJ+dlmnZSe0AKLQLUacGyo3zUAjFkSqE01wog7/RkYvw/gRZbHxdswHBEWJwqXsRz1f2eemHZhhTHJtjqm7JPT7YYASCj+mHeBu2eQ6MpjgEqJFM2FT0moR5Y= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(396003)(346002)(136003)(376002)(451199015)(46966006)(36840700001)(40470700004)(36756003)(40480700001)(186003)(83380400001)(316002)(66899015)(426003)(82310400005)(47076005)(336012)(478600001)(26005)(44832011)(70206006)(40460700003)(41300700001)(70586007)(86362001)(2616005)(82740400003)(2906002)(8936002)(6916009)(7696005)(8676002)(36860700001)(5660300002)(356005)(81166007)(2004002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6345 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 6bb7fdec-b8bd-4384-e683-08dab90317cb X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hqfh/TbBFJzxKt02s6f7eeH6JvpTPT9mcMeAC5KaEmX4bGFC4TNTcaeSz8gBOkLDhavkbvWNbiKvgYlqGwHYUWLRyXE4l2OTB0jcBuH7MOq2/7G9ZOFbonfeU5QTsbpvBwDPzX33TxMRrpk4zj9a4M7iOlCkCryGgfoX0R9kmNC3qsTiohz8a7Y0cQTQS8dqfl8DdgdgJWgo7MHsaej+6OFrXvTUAEsFxWH5/IzthYjYBll3FzYfkrLl1jHzaRyYXaNS7FhY1HBcxwm0CqX1VrWNHJ04RlzKyMhkuQHc/kb8HrkDFHg3qLaUVxy9K/p+Eu6giGfo5s7RBENCf3tQTlJLUH+c22D/nC1koEY0l4dXMLUHb1NKVg/WRCeAzy82tlIOtl/5rnV6JpH8h7a1t4C7YzinmS+rjmsNz8h5bm9d+UOMQW6um56aH/EQD8uelYwS8hS08S2Q1L940bBDOaclBuAc6qZt5TC3CtGd19v0jcIV9euHplVluLuv5qZgpik4vyQEz0HijDYGJ6AeklP7HgQ968ALbHLMaO45AmOHyz1cEmdih3HEf4L/dswK58FtQrMHbu79XeZmmvzSGDg5uAwR4seu1oxnY0+LvAHYJxF1N3+YrlKv+BCM+/dk4xxdZsNwymekG3GXZfD1y84Ei9FBIe7zrsk7EdscrRs7LCUGeGqbjXE4Uwi1xJrmuo7lYBV7bA5gQEjW3mEw6bxSvyPj72DsYohzM7zms3C3tY8yW3RZo9jGqo8OyH6cCxJUXntojT40LyA1cFnMoBdxK7iZCRLgn2gwbrcaKmEflzOycAoLjxjvuaP3sSME X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230022)(4636009)(136003)(396003)(39860400002)(346002)(376002)(451199015)(46966006)(36840700001)(40470700004)(426003)(47076005)(83380400001)(81166007)(86362001)(36860700001)(82740400003)(40460700003)(2906002)(44832011)(5660300002)(8676002)(8936002)(41300700001)(70206006)(82310400005)(70586007)(26005)(2616005)(336012)(7696005)(316002)(186003)(6916009)(478600001)(66899015)(36756003)(40480700001)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2022 16:40:33.6397 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0577e421-ac67-4754-b5a7-08dab9032236 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6519 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Turns out scratch_buffer_dupfree internal API was unused since commit ef0700004bf0dccf493a5e8e21f71d9e7972ea9f stdlib: Simplify buffer management in canonicalize And the related test in malloc/tst-scratch_buffer had issues so it's better to remove it completely. Reviewed-by: Florian Weimer --- v2: remove all reference to scratch_buffer_dupfree --- include/scratch_buffer.h | 16 ------------- malloc/Makefile | 1 - malloc/scratch_buffer_dupfree.c | 41 --------------------------------- malloc/tst-scratch_buffer.c | 20 ---------------- 4 files changed, 78 deletions(-) delete mode 100644 malloc/scratch_buffer_dupfree.c diff --git a/include/scratch_buffer.h b/include/scratch_buffer.h index e4c5c8a85d..a9bdcadec2 100644 --- a/include/scratch_buffer.h +++ b/include/scratch_buffer.h @@ -132,20 +132,4 @@ scratch_buffer_set_array_size (struct scratch_buffer *buffer, (buffer, nelem, size)); } -/* Return a copy of *BUFFER's first SIZE bytes as a heap-allocated block, - deallocating *BUFFER if it was heap-allocated. SIZE must be at - most *BUFFER's size. Return NULL (setting errno) on memory - exhaustion. */ -void *__libc_scratch_buffer_dupfree (struct scratch_buffer *buffer, - size_t size); -libc_hidden_proto (__libc_scratch_buffer_dupfree) - -/* Alias for __libc_scratch_dupfree. */ -static __always_inline void * -scratch_buffer_dupfree (struct scratch_buffer *buffer, size_t size) -{ - void *r = __libc_scratch_buffer_dupfree (buffer, size); - return __glibc_likely (r != NULL) ? r : NULL; -} - #endif /* _SCRATCH_BUFFER_H */ diff --git a/malloc/Makefile b/malloc/Makefile index 4e32de2a0b..211be75e36 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -123,7 +123,6 @@ tests-mcheck = $(filter-out $(tests-exclude-mcheck) $(tests-static), $(tests)) endif routines = malloc mcheck mtrace obstack reallocarray \ - scratch_buffer_dupfree \ scratch_buffer_grow scratch_buffer_grow_preserve \ scratch_buffer_set_array_size \ dynarray_at_failure \ diff --git a/malloc/scratch_buffer_dupfree.c b/malloc/scratch_buffer_dupfree.c deleted file mode 100644 index eb3b95c1b1..0000000000 --- a/malloc/scratch_buffer_dupfree.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Variable-sized buffer with on-stack default allocation. - Copyright (C) 2020-2022 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 - . */ - -#ifndef _LIBC -# include -#endif - -#include -#include - -void * -__libc_scratch_buffer_dupfree (struct scratch_buffer *buffer, size_t size) -{ - void *data = buffer->data; - if (data == buffer->__space.__c) - { - void *copy = malloc (size); - return copy != NULL ? memcpy (copy, data, size) : NULL; - } - else - { - void *copy = realloc (data, size); - return copy != NULL ? copy : data; - } -} -libc_hidden_def (__libc_scratch_buffer_dupfree) diff --git a/malloc/tst-scratch_buffer.c b/malloc/tst-scratch_buffer.c index 9fcb11ba2c..1f1e770486 100644 --- a/malloc/tst-scratch_buffer.c +++ b/malloc/tst-scratch_buffer.c @@ -151,26 +151,6 @@ do_test (void) && array_size_must_fail (4, ((size_t)-1) / 4))) return 1; } - { - struct scratch_buffer buf; - scratch_buffer_init (&buf); - memset (buf.data, '@', buf.length); - - size_t sizes[] = { 16, buf.length, buf.length + 16 }; - for (int i = 0; i < array_length (sizes); i++) - { - /* The extra size is unitialized through realloc. */ - size_t l = sizes[i] > buf.length ? sizes[i] : buf.length; - void *r = scratch_buffer_dupfree (&buf, l); - void *c = xmalloc (l); - memset (c, '@', l); - TEST_COMPARE_BLOB (r, l, buf.data, l); - free (r); - free (c); - } - - scratch_buffer_free (&buf); - } return 0; }