
On Thu, Feb 03, 2022 at 02:59:33PM +0100, Ján Tomko wrote:
On a Thursday in 2022, Andrea Bolognani wrote:
In order to match the existing virStringParse*() and virStrTo*() functions, input arguments should come before output arguments.
Or, even better, the virStr* functions should be inverted to match the approach we do elsewhere (VIR_STRDUP, virCommand come to mind) where the output arguments come first. (Just like they do when you do an assignment.)
Which virCommand APIs do you have in mind specifically? I see char *virCommandToString(virCommand *cmd, bool linebreaks); char *virCommandToStringFull(virCommand *cmd, bool linebreaks, bool stripCommandPath); int virCommandToStringBuf(virCommand *cmd, virBuffer *buf, bool linebreaks, bool stripCommandPath); int virCommandGetArgList(virCommand *cmd, char ***args); and, in all cases where the output is not returned directly, the output argument comes after at least *some* of the input arguments, never first. VIR_STRDUP() was dropped more than two years ago. Note that I'm not against leaving the arguments as they are if that results in a more consistent API, I just have the impression that the overwhelming majority of our APIs don't put the output argument first. I could definitely be convinced of the opposite :) -- Andrea Bolognani / Red Hat / Virtualization