From f33a04193092e3df8c9b1ac4f560018b95925f61 Mon Sep 17 00:00:00 2001 From: Rangi Date: Sat, 12 Mar 2022 22:38:29 -0500 Subject: Allow alternate labels for patch names --- tools/make_patch.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'tools/make_patch.c') diff --git a/tools/make_patch.c b/tools/make_patch.c index 9546349da..a67a4a399 100644 --- a/tools/make_patch.c +++ b/tools/make_patch.c @@ -344,16 +344,26 @@ struct Buffer *process_template(const char *template_filename, const char *patch case '[': // "[...]" is a patch label; buffer its contents putc(c, output); + bool alternate = false; buffer->size = 0; for (c = getc(input); c != EOF; c = getc(input)) { - putc(c, output); - if (c == ']') { + if (!alternate && c == '@') { + // "@" designates an alternate name for the ".VC_" label + alternate = true; + buffer->size = 0; + } else if (c == ']') { + putc(c, output); break; - } else if (!isalnum(c) && c != '_' && c != '@' && c != '#') { - // Convert non-identifier characters to underscores - c = '_'; + } else { + if (!alternate) { + putc(c, output); + if (!isalnum(c) && c != '_') { + // Convert non-identifier characters to underscores + c = '_'; + } + } + buffer_append(buffer, &c); } - buffer_append(buffer, &c); } buffer_append(buffer, &(char []){'\0'}); // The current patch should have a corresponding ".VC_" label -- cgit v1.2.3