[libvirt] [PATCH 10/75] libxl: Drop virAsprintf() and virAsprintfQuiet() retval checking
Ján Tomko
jtomko at redhat.com
Tue Oct 22 21:17:17 UTC 2019
On Tue, Oct 22, 2019 at 03:57:14PM +0200, Michal Privoznik wrote:
>These functions can't fail really. Drop checking of their retval
>then.
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> src/libxl/libxl_conf.c | 34 +++++++++++-----------------------
> src/libxl/libxl_domain.c | 35 +++++++++++++----------------------
> src/libxl/libxl_domain.h | 2 +-
> src/libxl/libxl_driver.c | 19 +++++++------------
> src/libxl/libxl_logger.c | 11 ++++-------
> src/libxl/libxl_migration.c | 9 +++------
> src/libxl/xen_common.c | 11 +++++------
> src/libxl/xen_xl.c | 18 ++++++------------
> src/libxl/xen_xm.c | 6 ++----
> 9 files changed, 52 insertions(+), 93 deletions(-)
>
>@@ -931,7 +931,7 @@ libxlDomainCleanup(libxlDriverPrivatePtr driver,
> *
> * virDomainObjPtr must be locked on invocation
> */
>-int
>+void
Changing the return type can be done later,
> libxlDomainAutoCoreDump(libxlDriverPrivatePtr driver,
> virDomainObjPtr vm)
> {
>@@ -940,28 +940,19 @@ libxlDomainAutoCoreDump(libxlDriverPrivatePtr driver,
> char timestr[100];
> struct tm time_info;
> char *dumpfile = NULL;
>- int ret = -1;
>
> localtime_r(&curtime, &time_info);
> strftime(timestr, sizeof(timestr), "%Y-%m-%d-%H:%M:%S", &time_info);
>
>- if (virAsprintf(&dumpfile, "%s/%s-%s",
>- cfg->autoDumpDir,
>- vm->def->name,
>- timestr) < 0)
>- goto cleanup;
>+ virAsprintf(&dumpfile, "%s/%s-%s", cfg->autoDumpDir, vm->def->name,
>+ timestr);
>
> /* Unlock virDomainObj while dumping core */
> virObjectUnlock(vm);
> libxl_domain_core_dump(cfg->ctx, vm->def->id, dumpfile, NULL);
> virObjectLock(vm);
>
>- ret = 0;
for now, you can just leave this ret = 0 here.
Jano
>-
>- cleanup:
> VIR_FREE(dumpfile);
>-
>- return ret;
> }
>
> int
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20191022/14f7e278/attachment-0001.sig>
More information about the libvir-list
mailing list