mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: "Robert P. J. Day" <rpjday@mindspring.com>
Cc: Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: CodingStyle:  "kzalloc()" versus "kcalloc(1,...)"
Date: Wed, 13 Dec 2006 17:39:39 +0100	[thread overview]
Message-ID: <20061213163939.GJ3851@stusta.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0612071912030.22957@localhost.localdomain>

On Thu, Dec 07, 2006 at 07:16:15PM -0500, Robert P. J. Day wrote:
> 
>   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,...)?

kcalloc() calls kzalloc(), so it doesn't matter at all which to use.

> rday

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


      reply	other threads:[~2006-12-13 16:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-08  0:16 Robert P. J. Day
2006-12-13 16:39 ` Adrian Bunk [this message]

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=20061213163939.GJ3851@stusta.de \
    --to=bunk@stusta.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpjday@mindspring.com \
    /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®