Just retested. This patch lowers size on x86 from 52144 to 52072

On Tue, 2017-11-07 at 12:22 -0800, Rosen Penev wrote:
> Change to calloc instead. Less verbose.
> 
> Signed-off-by: Rosen Penev <ros...@gmail.com>
> ---
>  log/syslog.c | 4 +---
>  lsbloader.c  | 3 +--
>  2 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/log/syslog.c b/log/syslog.c
> index af6530c..0e1f2a9 100644
> --- a/log/syslog.c
> +++ b/log/syslog.c
> @@ -246,15 +246,13 @@ log_list(int count, struct log_head *h)
>  int
>  log_buffer_init(int size)
>  {
> -     struct log_head *_log = malloc(size);
> +     struct log_head *_log = calloc(1, size);
>  
>       if (!_log) {
>               fprintf(stderr, "Failed to initialize log buffer
> with size %d\n", log_size);
>               return -1;
>       }
>  
> -     memset(_log, 0, size);
> -
>       if (log && ((log_size + sizeof(struct log_head)) < size)) {
>               struct log_head *start = _log;
>               struct log_head *end = ((void*) _log) + size;
> diff --git a/lsbloader.c b/lsbloader.c
> index b40a505..3d980c4 100644
> --- a/lsbloader.c
> +++ b/lsbloader.c
> @@ -78,12 +78,11 @@ static int initd_parse(const char *file)
>       }
>       buffer[len] = '\0';
>  
> -     i = malloc(sizeof(struct initd));
> +     i = calloc(1, sizeof(struct initd));
>       if (!i) {
>               fprintf(stderr, "failed to alloc initd struct\n");
>               return -1;
>       }
> -     memset(i, 0, sizeof(*i));
>  
>       if (!regexec(&pat_provides, buffer, 2, matches, 0))
>               i->name = strndup(buffer + matches[1].rm_so,
> (size_t)matches[1].rm_eo - matches[1].rm_so);

_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to