Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] remove unnecessary checks for NULL in zfree and zsfree
- X-seq: zsh-workers 42412
- From: Taylor West <krokodileglue@xxxxxxxxxxx>
- To: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] remove unnecessary checks for NULL in zfree and zsfree
- Date: Thu, 1 Mar 2018 01:17:12 +0000
- Accept-language: en-US
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Gtbs7ifdrIv72gKPTFcmNiT4D6PGPjBNu0Cpn6ZmVw8=; b=qr6vyO9Fp8rAsWrI1rTq47ZFyWTUSb/HLp3wh4woru6+LsEzperJ/0ykVm/xsXUoibPePWy8hSIBm7EePl9H7uZma5US4THpVPP06EyVy1STXXiSWIOFwkZPkqFxUhnbzXME5ee+YNsF09eoXRftoOGoPaOC/xsDtCYEeoLAd3+VgEaxvITMMkZ7vygL24NnjCmuoZ0zzArvbMyyYs5uMSg2tt72wbIpnOhoGUpGFVWaUkx9vFENUFTbs9tCW2LPqsPuMIQ3oO/p8hYBrgrHyz9zW9EQLT9rnuT/9+HQc76KhjaJW50WExy8th/kpOIF4GKVKZ9k1Sv0iOsyXDzf9Q==
- In-reply-to: <SN1PR06MB22882C38BE26E6312E16411FB1C60@SN1PR06MB2288.namprd06.prod.outlook.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <SN1PR06MB22882C38BE26E6312E16411FB1C60@SN1PR06MB2288.namprd06.prod.outlook.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
- Thread-index: AQHTsPrO5gNXQaJqDUyao2SqzTE4qaO6k/bI
- Thread-topic: [PATCH] remove unnecessary checks for NULL in zfree and zsfree
According to section 7.22.3.3 paragraph 2 of the final committee draft
of the C11 standard, if free() is passed a NULL pointer then "no
action occurs". The current checks on `p' in zfree and zsfree are
unnecessary---this patch removes them.
________________________________
From: Taylor West <KrokodileGlue@xxxxxxxxxxx>
Sent: Wednesday, February 28, 2018 5:15 PM
To: zsh-workers@xxxxxxx
Cc: Taylor West
Subject: [PATCH] remove unnecessary checks for NULL in zfree and zsfree
---
Src/mem.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/Src/mem.c b/Src/mem.c
index f120819..77e4375 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -1885,16 +1885,14 @@ bin_mem(char *name, char **argv, Options ops, int func)
mod_export void
zfree(void *p, UNUSED(int sz))
{
- if (p)
- free(p);
+ free(p);
}
/**/
mod_export void
zsfree(char *p)
{
- if (p)
- free(p);
+ free(p);
}
/**/
--
2.9.5
Messages sorted by:
Reverse Date,
Date,
Thread,
Author