Another dead store. Refreshingly shallow. The function below starts like this: static int openvzDomainDefineCmd(virConnectPtr conn, const char *args[], int maxarg, virDomainDefPtr vmdef) { int narg; int veid; int max_veid; and there are no intervening uses of "max_veid". >From 7333ff9e0cf83d243dba752d293d9007ded5e9f8 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@xxxxxxxxxx> Date: Mon, 1 Mar 2010 21:38:06 +0100 Subject: [PATCH] openvzDomainDefineCmd: remove useless increment * src/openvz/openvz_driver.c (openvzDomainDefineCmd): Remove useless increment of "max_veid". --- src/openvz/openvz_driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 5057b81..4673b6c 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -137,65 +137,65 @@ openvzDomainDefineCmd(virConnectPtr conn, narg = 0; ADD_ARG_LIT(VZCTL); ADD_ARG_LIT("--quiet"); ADD_ARG_LIT("create"); if ((fp = popen(VZLIST " -a -ovpsid -H 2>/dev/null", "r")) == NULL) { openvzError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("popen failed")); return -1; } max_veid = 0; while (!feof(fp)) { if (fscanf(fp, "%d\n", &veid) != 1) { if (feof(fp)) break; openvzError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to parse vzlist output")); goto cleanup; } if (veid > max_veid) { max_veid = veid; } } fclose(fp); if (max_veid == 0) { max_veid = 100; } else { max_veid++; } - sprintf(str_id, "%d", max_veid++); + sprintf(str_id, "%d", max_veid); ADD_ARG_LIT(str_id); ADD_ARG_LIT("--name"); ADD_ARG_LIT(vmdef->name); if (vmdef->nfss == 1 && vmdef->fss[0]->type == VIR_DOMAIN_FS_TYPE_TEMPLATE) { ADD_ARG_LIT("--ostemplate"); ADD_ARG_LIT(vmdef->fss[0]->src); } #if 0 if ((vmdef->profile && *(vmdef->profile))) { ADD_ARG_LIT("--config"); ADD_ARG_LIT(vmdef->profile); } #endif ADD_ARG(NULL); return 0; no_memory: openvzError(conn, VIR_ERR_INTERNAL_ERROR, _("Could not put argument to %s"), VZCTL); return -1; cleanup: fclose(fp); return -1; #undef ADD_ARG #undef ADD_ARG_LIT } -- 1.7.0.1.414.g89213d -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list