mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Replace virInterfaceFree with virObjectUnref
Since virInterfaceFree will call virObjectUnref anyway, let's just use that directly so as to avoid the possibility that we inadvertently clear out a pending error message when using the public API.
This commit is contained in:
parent
7b4938f524
commit
c56a591a84
4
cfg.mk
4
cfg.mk
@ -992,7 +992,7 @@ sc_prohibit_system_error_with_vir_err:
|
||||
# functions. There's a corresponding exclude to allow usage within tests,
|
||||
# docs, examples, tools, src/libvirt-*.c, and include/libvirt/libvirt-*.h
|
||||
sc_prohibit_virXXXFree:
|
||||
@prohibit='\bvir(Domain|Network|NodeDevice|StorageVol|StoragePool|Stream|Secret|NWFilter)Free\b' \
|
||||
@prohibit='\bvir(Domain|Network|NodeDevice|StorageVol|StoragePool|Stream|Secret|NWFilter|Interface)Free\b' \
|
||||
exclude='sc_prohibit_virXXXFree' \
|
||||
halt='avoid using 'virXXXFree', use 'virObjectUnref' instead' \
|
||||
$(_sc_search_regexp)
|
||||
@ -1186,4 +1186,4 @@ exclude_file_name_regexp--sc_prohibit_devname = \
|
||||
^(tools/virsh.pod|cfg.mk|docs/.*)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_virXXXFree = \
|
||||
^(docs/|tests/|examples/|tools/|cfg.mk|src/test/test_driver.c|src/libvirt_public.syms|include/libvirt/libvirt-(domain|network|nodedev|storage|stream|secret|nwfilter).h|src/libvirt-(domain|qemu|network|nodedev|storage|stream|secret|nwfilter).c$$)
|
||||
^(docs/|tests/|examples/|tools/|cfg.mk|src/test/test_driver.c|src/libvirt_public.syms|include/libvirt/libvirt-(domain|network|nodedev|storage|stream|secret|nwfilter|interface).h|src/libvirt-(domain|qemu|network|nodedev|storage|stream|secret|nwfilter|interface).c$$)
|
||||
|
@ -4846,7 +4846,7 @@ remoteDispatchConnectListAllInterfaces(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
virNetMessageSaveError(rerr);
|
||||
if (ifaces && nifaces > 0) {
|
||||
for (i = 0; i < nifaces; i++)
|
||||
virInterfaceFree(ifaces[i]);
|
||||
virObjectUnref(ifaces[i]);
|
||||
VIR_FREE(ifaces);
|
||||
}
|
||||
return rv;
|
||||
|
@ -675,10 +675,8 @@ netcfConnectListAllInterfaces(virConnectPtr conn,
|
||||
VIR_FREE(names);
|
||||
|
||||
if (tmp_iface_objs) {
|
||||
for (i = 0; i < niface_objs; i++) {
|
||||
if (tmp_iface_objs[i])
|
||||
virInterfaceFree(tmp_iface_objs[i]);
|
||||
}
|
||||
for (i = 0; i < niface_objs; i++)
|
||||
virObjectUnref(tmp_iface_objs[i]);
|
||||
VIR_FREE(tmp_iface_objs);
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,7 @@ udevConnectListAllInterfaces(virConnectPtr conn,
|
||||
|
||||
if (ifaces) {
|
||||
for (tmp_count = 0; tmp_count < count; tmp_count++)
|
||||
virInterfaceFree(ifaces_list[tmp_count]);
|
||||
virObjectUnref(ifaces_list[tmp_count]);
|
||||
}
|
||||
|
||||
VIR_FREE(ifaces_list);
|
||||
|
@ -3321,8 +3321,7 @@ remoteConnectListAllInterfaces(virConnectPtr conn,
|
||||
cleanup:
|
||||
if (tmp_ifaces) {
|
||||
for (i = 0; i < ret.ifaces.ifaces_len; i++)
|
||||
if (tmp_ifaces[i])
|
||||
virInterfaceFree(tmp_ifaces[i]);
|
||||
virObjectUnref(tmp_ifaces[i]);
|
||||
}
|
||||
VIR_FREE(tmp_ifaces);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user