mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
virNetworkObjSetMacMap: take double pointer of @macmap
The virNetworkObjSetMacMap() API effectively steals passed @macmap argument. However, the argument is a plain, first order pointer. This requires every caller to set the argument to NULL after the function was called. Let's make the function take double pointer instead to make it obvious that the argument is consumed. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3fe52b7818
commit
107dfcea34
@ -240,9 +240,9 @@ virNetworkObjSetFloorSum(virNetworkObj *obj,
|
||||
|
||||
void
|
||||
virNetworkObjSetMacMap(virNetworkObj *obj,
|
||||
virMacMap *macmap)
|
||||
virMacMap **macmap)
|
||||
{
|
||||
obj->macmap = macmap;
|
||||
obj->macmap = g_steal_pointer(macmap);
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ virNetworkObjSetFloorSum(virNetworkObj *obj,
|
||||
|
||||
void
|
||||
virNetworkObjSetMacMap(virNetworkObj *obj,
|
||||
virMacMap *macmap);
|
||||
virMacMap **macmap);
|
||||
|
||||
void
|
||||
virNetworkObjUnrefMacMap(virNetworkObj *obj);
|
||||
|
@ -475,8 +475,7 @@ networkUpdateState(virNetworkObj *obj,
|
||||
if (!(macmap = virMacMapNew(macMapFile)))
|
||||
return -1;
|
||||
|
||||
virNetworkObjSetMacMap(obj, macmap);
|
||||
macmap = NULL;
|
||||
virNetworkObjSetMacMap(obj, &macmap);
|
||||
|
||||
break;
|
||||
|
||||
@ -1972,8 +1971,7 @@ networkStartNetworkVirtual(virNetworkDriverState *driver,
|
||||
!(macmap = virMacMapNew(macMapFile)))
|
||||
goto error;
|
||||
|
||||
virNetworkObjSetMacMap(obj, macmap);
|
||||
macmap = NULL;
|
||||
virNetworkObjSetMacMap(obj, &macmap);
|
||||
|
||||
/* Set bridge options */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user