On 1/26/26 19:09, Richard W.M. Jones wrote: > Abstract the places where we create URLs into one place. This is just > refactoring and should not change the behaviour. > > Signed-off-by: Richard W.M. Jones <[email protected]> > --- > src/esx/esx_driver.c | 53 +++++++++++++++++++++++++++++++++++--------- > 1 file changed, 43 insertions(+), 10 deletions(-) > > diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c > index 02f30c2b19..8fdfe0a656 100644 > --- a/src/esx/esx_driver.c > +++ b/src/esx/esx_driver.c > @@ -582,7 +582,37 @@ esxCapsInit(esxPrivate *priv) > return NULL; > } > > +static char * > +esxCreateURL(const char *transport, > + const char *server, > + int port, > + const char *path) > +{ > + char *url; > > + url = g_strdup_printf("%s://%s:%d%s", > + transport, > + server, > + port, > + path); > + return url; > +} > + > +/* > + * Same as above, but add it to a buffer because the calling code will > + * append query strings etc. > + */ > +static void > +esxCreateURLBuffer(virBuffer *buffer, > + const char *transport, > + const char *server, > + int port, > + const char *path) > +{ > + g_autofree char *url = esxCreateURL(transport, server, port, path); > + > + virBufferAdd(buffer, url, strlen(url));
Nitpick: you can s/strlen(url)/-1/ as virBufferAdd will calculate the length in that case. Michal
