On Mon, Feb 06 2023, Matthew John Cheetham via GitGitGadget wrote: > From: Matthew John Cheetham <mjcheetham@xxxxxxxxxxx> > @@ -263,6 +263,16 @@ static void credential_write_item(FILE *fp, const char *key, const char *value, > fprintf(fp, "%s=%s\n", key, value); > } > > +static void credential_write_strvec(FILE *fp, const char *key, > + const struct strvec *vec) > +{ > + char *full_key = xstrfmt("%s[]", key); FWIW you could avoid this allocation if you just renamed the current "credential_write_item()" to "credential_write_fmt()", and had it take a format instead of its current hardcoded "%s=%s\n". Then you could have two wrappers, credential_write_item() and credential_write_items() (instead of "strvec"), the first passing "%s=%s\n", the other "%s[]=%s\n". Just a thought. > + for (size_t i = 0; i < vec->nr; i++) { > + credential_write_item(fp, full_key, vec->v[i], 0); The {} here can be dropped in any case.