Federico Simoncelli has posted comments on this change. Change subject: utils: Correct and faster list2cmdline ......................................................................
Patch Set 6: Code-Review-1 (1 comment) Marking -1 for visibility. http://gerrit.ovirt.org/#/c/27548/6/lib/vdsm/utils.py File lib/vdsm/utils.py: Line 657: parts = [] Line 658: for arg in args: Line 659: if _needs_quoting(arg) or arg == '': Line 660: quoted = ("'" + s + "'" for s in arg.split("'")) Line 661: arg = r"\'".join(quoted) I suggest: def _list2cmdline(args): """...""" parts = [] for arg in args: if _needs_quoting(arg) or arg == '': arg = "'" + arg.replace("'", r"'\''") + "'" parts.append(arg) return ' '.join(parts) It's clearer, it passes the tests and profiling it seems also faster (-45%). Line 662: parts.append(arg) Line 663: return ' '.join(parts) Line 664: Line 665: -- To view, visit http://gerrit.ovirt.org/27548 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibfc7819c126fe51cc068cc6f9f85b1002878385b Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <[email protected]> Gerrit-Reviewer: Adam Litke <[email protected]> Gerrit-Reviewer: Allon Mureinik <[email protected]> Gerrit-Reviewer: Alon Bar-Lev <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Federico Simoncelli <[email protected]> Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: Saggi Mizrahi <[email protected]> Gerrit-Reviewer: Yaniv Bronhaim <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
