
On 07/19/2013 08:51 AM, Daniel P. Berrange wrote:
+ if (virCgroupSetValueU64(group, + VIR_CGROUP_CONTROLLER_MEMORY, + filename, 1) < 0) return -1; - }
return 0;
Can code like this be simplified to:
return virCgroupSetValueU64(group, VIR_CGROUP_CONTROLLER_MEMORY, filename, 1);
I'm not a fan of doing that, since it means it'll be re-arranged again if we ever put move code in this method.
Fair enough - don't change it.
- ignore_value(VIR_STRNDUP_QUIET(ret, group->controllers[i].mountPoint, - tmp - group->controllers[i].mountPoint)); + if (VIR_STRNDUP(ret, group->controllers[i].mountPoint, + tmp - group->controllers[i].mountPoint) < 0) + return NULL; return ret;
You can still use ignore_value() here rather than 'if', if desired, since ret will be NULL if VIR_STRNDUP fails.
I don't like that kind of use of ignore_value(). It makes it really easy for someone else to screw things up later by adding in more code between the VIR_STRNDUP & the following 'return ret'. An explicit 'return NULL' is safe in that scenario.
Also a reasonable explanation. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org