From: "Robert P. J. Day" <rpjday@mindspring.com>
To: Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: CodingStyle: "kzalloc()" versus "kcalloc(1,...)"
Date: Thu, 7 Dec 2006 19:16:15 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.64.0612071912030.22957@localhost.localdomain> (raw)
i just noticed that there are numerous invocations of kcalloc()
where the hard-coded first arg of # elements is "1", which seems like
an inappropriate use of kcalloc().
the only rationale i can see is that kcalloc() guarantees that the
memory will be set to zero, so i'm guessing that this form of
kcalloc() was used before kzalloc() existed, or was used by folks who
didn't know that kzalloc() existed.
if a (zero-filled) single struct is being allocated, is it worth
codifying that that allocation should use kzalloc() and not
kcalloc(1,...)?
rday
next reply other threads:[~2006-12-08 0:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-08 0:16 Robert P. J. Day [this message]
2006-12-13 16:39 ` Adrian Bunk
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0612071912030.22957@localhost.localdomain \
--to=rpjday@mindspring.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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
all inboxes | Powered by JetHome®