[PATCH] conf: convert network_conf.c to use g_auto* pointers
Laine Stump
laine at redhat.com
Thu Jun 11 04:09:34 UTC 2020
On 6/10/20 3:51 AM, Erik Skultety wrote:
> On Wed, Jun 10, 2020 at 12:16:50AM -0400, Laine Stump wrote:
>> This was mostly boilerplate conversion, but in one case I needed to
>> define several differently named char* to take the place of a single
>> char *tmp that was re-used multiple times, and in another place there
>> was a single char* that was used at the toplevel of the function, and
>> then later used repeatedly inside a for loop, so I defined a new
>> separate char* inside the loop.
>>
>> Signed-off-by: Laine Stump <laine at redhat.com>
>> ---
>>
>> This should be applied on top of Dan's IPv6 NAT patch series (it was
>> reviewing that series that showed me this file hadn't yet been
>> converted).
> ...
>
>> @@ -689,14 +678,12 @@ virNetworkDHCPDefParseXML(const char *networkName,
>>
>> if (server &&
>> virSocketAddrParse(&inaddr, server, AF_UNSPEC) < 0) {
>> - VIR_FREE(file);
>> - VIR_FREE(server);
>> goto cleanup;
>> }
>>
>> def->bootfile = file;
>> + file = NULL;
> g_steal_pointer would do as well
>
> Reviewed-by: Erik Skultety <eskultet at redhat.com>
>
Well, Duh! Where was my brain while I was doing that mindless conversion??
This made me realized there's actually several places with the x = y; y
= NULL; pattern associated with no-autofree'd pointers. If it's okay
with you, I'll squash the following into the patch before I push it (or,
if you'd prefer I can push it separately):
(Thanks for the review, BTW)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-conf-use-g_steal_pointer-in-network_conf.c.patch
Type: text/x-patch
Size: 2243 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200611/4b4eb05d/attachment-0001.bin>
More information about the libvir-list
mailing list