9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Arne Meyer <meyer.arne83@netcologne.de>
To: "9front@9front.org" <9front@9front.org>
Subject: [9front] [patch] skelfs: remove useless code
Date: Fri, 11 Nov 2022 18:17:45 +0100 (CET)	[thread overview]
Message-ID: <2110680159.4595621.1668187065209@comcenter.netcologne.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 162 bytes --]

if I read the code correctly emalloc9p already checks for failed allocations and zeroes the memory, so the following code is redundant.


[-- Attachment #2: skelfs.patch --]
[-- Type: application/octet-stream, Size: 336 bytes --]

diff e5d29a2bd91951a24fccecd958416856cecef444 uncommitted
--- a/sys/src/cmd/skelfs.c
+++ b/sys/src/cmd/skelfs.c
@@ -101,9 +101,6 @@
 	s = old->aux;
 	s2 = emalloc9p(sizeof *s2);
-	if(s2 == nil)
-		return "out of memory";
-	memset(s2, 0, sizeof *s2);
 	s2->mode = s->mode;
 	utfecpy(s2->name, &s2->name[sizeof s2->name-1], s->name);

             reply	other threads:[~2022-11-11 17:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11 17:17 Arne Meyer [this message]
2022-11-11 17:37 ` Jacob Moody
2022-11-11 17:52   ` Arne Meyer
2022-11-11 19:20     ` Jacob Moody
2022-11-12 10:20       ` Arne Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2110680159.4595621.1668187065209@comcenter.netcologne.de \
    --to=meyer.arne83@netcologne.de \
    --cc=9front@9front.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).