[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/8] bsd-user/elfload.c: Replaced calls to malloc/free with G
From: |
Alex Bennée |
Subject: |
Re: [PATCH 1/8] bsd-user/elfload.c: Replaced calls to malloc/free with GLib variants |
Date: |
Mon, 15 Mar 2021 17:56:21 +0000 |
User-agent: |
mu4e 1.5.10; emacs 28.0.50 |
Mahmoud Mandour <ma.mandourr@gmail.com> writes:
> Given this is start-up code I think you could use g_new instead of
> g_try_new. As it will abort on no memory you can avoid the early return
> check bellow. Also is elf_phdata never persists beyond this function you
> could use g_autofree (and use g_steal_pointer on the one case when it is
> returned if you need it)
>
> I would also split this patch, one for each function you convert.
>
>
> Thank you for the valuable suggestions, these are obviously the better
> way to go. I will hopefully employ them.
> I'm now busy with my final exams. In a week or so, I will make the
> changes again and properly, split the patch, and then send it as a
> series regarding this file.
We are also trying to improve the language in the coding style document
if you see the thread:
Subject: [RFC PATCH] docs/devel: expand style section of memory management
Date: Mon, 15 Mar 2021 16:53:12 +0000
Message-Id: <20210315165312.22453-1-alex.bennee@linaro.org>
apologies, I did intend to cc you as well but forgot in my haste to post.
>
> Thanks
> Mahmoud Mandour
--
Alex Bennée
[PATCH 4/8] target/xtensa: Replaced malloc/free with GLib's variants, Mahmoud Mandour, 2021/03/13
[PATCH 7/8] tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc, Mahmoud Mandour, 2021/03/13