1
0
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:
Michal Privoznik 2022-08-09 11:38:43 +02:00
parent 3fe52b7818
commit 107dfcea34
3 changed files with 5 additions and 7 deletions

View File

@ -240,9 +240,9 @@ virNetworkObjSetFloorSum(virNetworkObj *obj,
void
virNetworkObjSetMacMap(virNetworkObj *obj,
virMacMap *macmap)
virMacMap **macmap)
{
obj->macmap = macmap;
obj->macmap = g_steal_pointer(macmap);
}

View File

@ -78,7 +78,7 @@ virNetworkObjSetFloorSum(virNetworkObj *obj,
void
virNetworkObjSetMacMap(virNetworkObj *obj,
virMacMap *macmap);
virMacMap **macmap);
void
virNetworkObjUnrefMacMap(virNetworkObj *obj);

View File

@ -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 */