Re: [PATCH] builtin/log.c: prepend "RFC" on --rfc
On Mon Aug 28, 2023 at 4:42 PM CEST, Jeff King wrote:
Show 17 quoted lines
> static int rfc_callback(const struct option *opt, const char *arg, int unset)
> {
> + /*
> + * "avoid" leak by holding on to a reference to the memory, since we
> + * need the string for the lifetime of the process anyway
> + */
> + static char *prefix;
> +
> BUG_ON_OPT_NEG(unset);
> BUG_ON_OPT_ARG(arg);
> - return subject_prefix_callback(opt, "RFC PATCH", unset);
> +
> + free(prefix);
> + prefix = xstrfmt("RFC %s", ((struct rev_info *)opt->value)->subject_prefix);
> +
> + return subject_prefix_callback(opt, prefix, unset);
> }I like this better, thanks!