From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sourceware.org (Postfix) with ESMTPS id 41B7F39CBC3A for ; Mon, 12 Apr 2021 06:19:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 41B7F39CBC3A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=inria.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Paul.Zimmermann@inria.fr IronPort-HdrOrdr: =?us-ascii?q?A9a23=3AZeQjIKPI0VGs6MBcTuyjsMiAIKoaSvp033AA?= =?us-ascii?q?3SlKJiB9X8SEm6mV98gz+gTzjF8qNU0IudfFA6WYRGOZyJgd2+csFJOvRhPvtm?= =?us-ascii?q?ftDIwK1+Hf6gbtESH/6eJRvJ0IG5RWM9H+AUN3isz3+mCDc+oI+sWN86yjmI7l?= =?us-ascii?q?rktFcAcCUc1d0zs=3D?= X-IronPort-AV: E=Sophos;i="5.82,214,1613430000"; d="scan'208";a="378362228" Received: from tomate.loria.fr (HELO tomate) ([152.81.10.51]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2021 08:19:25 +0200 Date: Mon, 12 Apr 2021 08:19:24 +0200 Message-Id: From: Paul Zimmermann To: Florian Weimer Cc: eggert@cs.ucla.edu, libc-alpha@sourceware.org In-Reply-To: <8735vwows4.fsf@oldenburg.str.redhat.com> (message from Florian Weimer on Mon, 12 Apr 2021 08:13:31 +0200) Subject: Re: Fix REALLOC_ZERO_BYTES_FREES comment References: <8735vwows4.fsf@oldenburg.str.redhat.com> X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Mon, 12 Apr 2021 06:19:27 -0000 Hi Florian, > > you write "If nonzero, ... should free p .... Otherwise ... should do the > > equivalent of freeing p". Is there a difference between "free p" and "do the > > equivalent of freeing p"? > > It's freeing p followed by malloc (0). sorry I was not clear. The complete sentence proposed by Paul is "Otherwise, realloc (p, 0) should do the equivalent of freeing p and returning what malloc (0) would return." Why not simply the following? "Otherwise, realloc (p, 0) should free p and return what malloc (0) would." Am I overlooking something? What puzzles me is why we write "free p" in the first part and "do the equivalent of freeing p" in the second one. Paul