[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [qemu-s390x] [Qemu-devel] [PATCH v4 02/11] machine: make MemoryHotpl

From: Markus Armbruster
Subject: Re: [qemu-s390x] [Qemu-devel] [PATCH v4 02/11] machine: make MemoryHotplugState accessible via the machine
Date: Mon, 14 May 2018 08:31:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Eduardo Habkost <address@hidden> writes:

> On Thu, May 10, 2018 at 06:57:32PM +0200, Paolo Bonzini wrote:
> [...]
>> > -    machine->device_memory = g_malloc(sizeof(*machine->device_memory));
>> > +    machine->device_memory = g_malloc0(sizeof(*machine->device_memory));
>> g_new0 since you are at it? :)
> Nice suggestion, but this was already merged.
> I think we have a Coccinelle script that should detect this?

Closest match is commit message b45c03f585e, referred to last in commit
bdd81addf40 (both predate scripts/coccinelle/).  However, that script
only rewrites patterns involving sizeof(T), such as

    g_malloc(sizeof(T) * n) -> g_new(T, n)

because those are obvious improvements.  It doesn't rewrite patterns

    T *v = g_malloc(sizeof(*v)) -> T *v = g_new(T, 1)

because whether those are improvements is debatable.

Feel free to apply them wherever you think they are enough of an
improvement to be worth the churn.  But I wouldn't apply them tree-write
without rough consensus "this is what we want going forward".

reply via email to

[Prev in Thread] Current Thread [Next in Thread]