diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2020-07-04 11:49:09 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2020-07-04 11:52:44 +0100 |
commit | 17c7c1729eaf770dd272205e249c200b22e9603c (patch) | |
tree | 882a5a37e8e48a9da4fbdce6cce18dbee0d62840 /tools | |
parent | 1ec0f3f9238d44eb9c60d72c3572c42c98cf2ad4 (diff) | |
download | orc-17c7c1729eaf770dd272205e249c200b22e9603c.tar.gz |
orcc: use #pragma once in generated headers
Simplifies code and removes build path fragments from
generated file (paths may be different if generated
in a gst-build setup).
There shouldn't be any portability issues with this. Meson
has been using this in its generated config.h for years.
Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/45>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/orcc.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/tools/orcc.c b/tools/orcc.c index 7d58593..3585e93 100644 --- a/tools/orcc.c +++ b/tools/orcc.c @@ -22,7 +22,6 @@ void output_code_assembly (OrcProgram *p, FILE *output); void output_code_execute (OrcProgram *p, FILE *output, int is_inline); void output_program_generation (OrcProgram *p, FILE *output, int is_inline); void output_init_function (FILE *output); -static char * get_barrier (const char *s); static const char * my_basename (const char *s); int verbose = 0; @@ -319,11 +318,7 @@ main (int argc, char *argv[]) fprintf(output, "\n"); } } else if (mode == MODE_HEADER) { - char *barrier = get_barrier (output_file); - - fprintf(output, "#ifndef _%s_\n", barrier); - fprintf(output, "#define _%s_\n", barrier); - free (barrier); + fprintf(output, "#pragma once\n"); fprintf(output, "\n"); if (include_file) { fprintf(output, "#include <%s>\n", include_file); @@ -357,8 +352,6 @@ main (int argc, char *argv[]) fprintf(output, "}\n"); fprintf(output, "#endif\n"); fprintf(output, "\n"); - fprintf(output, "#endif\n"); - fprintf(output, "\n"); } else if (mode == MODE_TEST) { fprintf(output, "#include <stdio.h>\n"); fprintf(output, "#include <string.h>\n"); @@ -450,28 +443,6 @@ main (int argc, char *argv[]) return 0; } - -static char * -get_barrier (const char *s) -{ - char *barrier; - int n; - int i; - - n = strlen(s); - barrier = malloc (n + 1); - for(i=0;i<n;i++) { - if (isalnum (s[i])) { - barrier[i] = toupper(s[i]); - } else { - barrier[i] = '_'; - } - } - barrier[n] = 0; - - return barrier; -} - static char * read_file (const char *filename) { |