Which of these does folks prefer (same would apply to SetMaxMem).
ONE
------
cmdSetmem(vshControl * ctl, vshCmd * cmd)
{
...
kilobytes = vshCommandOptInt(cmd, "kilobytes", &kilobytes);
if (kilobytes <= 0) {
virDomainFree(dom);
vshError(ctl, FALSE, _("Invalid value of %d for memory size"),
kilobytes);
return FALSE;
}
if (virDomainGetInfo(dom, &info) != 0) {
virDomainFree(dom);
vshError(ctl, FALSE, _("Unable to verify MaxMemorySize"));
return FALSE;
}
if (kilobytes > info.maxMem) {
virDomainFree(dom);
vshError(ctl, FALSE, _("Invalid value of %d for memory size"),
kilobytes);
return FALSE;
}
...
}
TWO
-----
cmdSetmem(vshControl * ctl, vshCmd * cmd)
{
...
kilobytes = vshCommandOptInt(cmd, "kilobytes", &kilobytes);
if (kilobytes <= 0) {
virDomainFree(dom);
vshError(ctl, FALSE, _("Invalid value of %d for memory size"),
kilobytes);
return FALSE;
}
if (virDomainGetInfo(dom, &info) == 0) {
if (kilobytes > info.maxMem) {
virDomainFree(dom);
vshError(ctl, FALSE, _("Invalid value of %d for memory
size"), kilobytes);
return FALSE;
}
}
...
}