diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2022-03-12 22:38:29 -0500 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2022-03-12 22:38:29 -0500 |
commit | f33a04193092e3df8c9b1ac4f560018b95925f61 (patch) | |
tree | 4891528df1dfd9643be93d4a9e3b07a0cfabe325 /tools/make_patch.c | |
parent | 31c3c94d64e1ac1e40c95acfda7de8b99b4f302b (diff) |
Allow alternate labels for patch names
Diffstat (limited to 'tools/make_patch.c')
-rw-r--r-- | tools/make_patch.c | 22 |
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 |