On 1/18/19 6:56 AM, Ján Tomko wrote: > On Thu, Jan 17, 2019 at 08:03:44AM -0500, John Ferlan wrote: >> >> >> On 1/15/19 8:23 AM, Ján Tomko wrote: >>> Split out parts of the config parsing code to make >>> the parent function easier to read. >>> >>> Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> >>> --- >>> src/qemu/qemu_conf.c | 36 +++++++++++++++++++++++++----------- >>> 1 file changed, 25 insertions(+), 11 deletions(-) >>> >>> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c >>> index 837bff6b30..325e5ccfd5 100644 >>> --- a/src/qemu/qemu_conf.c >>> +++ b/src/qemu/qemu_conf.c >>> @@ -423,6 +423,30 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr >>> hugetlbfs, >>> } >>> >>> >>> +static int >>> +virQEMUDriverConfigLoadSWTPMEntry(virQEMUDriverConfigPtr cfg, >>> + virConfPtr conf) >>> +{ >>> + char *swtpm_user = NULL, *swtpm_group = NULL; >> >> Some would note these should be on separate lines, but I'll note that >> since we have it, these should be: >> >> VIR_AUTOPTR(char *) swtpm_user = NULL; >> VIR_AUTOPTR(char *) swtpm_group = NULL; >> >>> + int ret = -1; >>> + >>> + if (virConfGetValueString(conf, "swtpm_user", &swtpm_user) < 0) >>> + goto cleanup; >>> + if (swtpm_user && virGetUserID(swtpm_user, &cfg->swtpm_user) < 0) >>> + goto cleanup; >>> + >>> + if (virConfGetValueString(conf, "swtpm_group", &swtpm_group) < 0) >>> + goto cleanup; >>> + if (swtpm_group && virGetGroupID(swtpm_group, &cfg->swtpm_group) >>> < 0) >>> + goto cleanup; >>> + >>> + ret = 0; >>> + cleanup: >>> + VIR_FREE(swtpm_user); >>> + VIR_FREE(swtpm_group); >> >> Thus freeing you of needing this and perhaps changing your logic above. >> >> I "understand" the "norm" is to just purely copy and then have another >> patch, but I really believe in this case it's so obvious that a separate >> patch isn't required especially since VIR_AUTOFREE is more commonly used. >> > > Yes, I'd rather not include any functional changes here (other than > those necessary to deal with the (lack of a) cleanup section. > > Jano So I see you left the AUTOPTR/AUTOFREE to some future change... Is that in your short term plan or waiting for some bite size libvirt first task to complete? John -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list