On 11/12/2017 10:53 PM, ros...@gmail.com wrote:
Tested compile size difference. Saves 32 bytes. ¯\_(ツ)_/¯
On Tue, 2017-11-07 at 12:05 -0800, Rosen Penev wrote:
Changes allocation to calloc and {} as needed.
Signed-off-by: Rosen Penev
---
inittab.c | 6 ++
plug/hotplug.c | 7 ++
Tested compile size difference. Saves 32 bytes. ¯\_(ツ)_/¯
On Tue, 2017-11-07 at 12:05 -0800, Rosen Penev wrote:
> Changes allocation to calloc and {} as needed.
>
> Signed-off-by: Rosen Penev
> ---
> inittab.c | 6 ++
> plug/hotplug.c | 7 ++-
> 2 files changed, 4 insertions(+), 9
Thanks, also for the link (https://vorpus.org/blog/why-does-calloc-exist/).
This article made me aware that using calloc() may be wise.
For security reasons: calloc avoids possible arrhythmic overflows when the
allocation size for malloc is the product of two numbers.
And because it may offer re
On Wed, 2017-11-08 at 11:57 +0100, Paul Oranje wrote:
> Both memset() and calloc() have highly optimised implementations, so
> the expected gains with this patch for the allocation of zeroed
> memory will be small at best. As this patch does not fix a bug: why
> is the change "needed" ?
>
Style ch
Both memset() and calloc() have highly optimised implementations, so the
expected gains with this patch for the allocation of zeroed memory will be
small at best. As this patch does not fix a bug: why is the change "needed" ?
Just curiosity, bye,
Paul
> Op 7 nov. 2017, om 21:05 heeft Rosen Pene
Changes allocation to calloc and {} as needed.
Signed-off-by: Rosen Penev
---
inittab.c | 6 ++
plug/hotplug.c | 7 ++-
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/inittab.c b/inittab.c
index 21172f7..c27c324 100644
--- a/inittab.c
+++ b/inittab.c
@@ -284,8 +284,7