lkml.org 
[lkml]   [2006]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectCodingStyle: "kzalloc()" versus "kcalloc(1,...)"

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-12-08 01:23    [W:0.353 / U:1.924 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site