summaryrefslogtreecommitdiff
path: root/tools/make_patch.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/make_patch.c')
-rw-r--r--tools/make_patch.c22
1 files changed, 16 insertions, 6 deletions
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