diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2020-10-15 06:43:21 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2020-10-15 06:43:21 -0400 |
commit | dd60560bfd804f430924647bab625f9e887c367d (patch) | |
tree | b3b192e92a87cf44a6dd633cf9427a6c3cfd82d0 /src/misc.c | |
parent | 20779d47a7762e707b07889b48647cd08f97fb0f (diff) | |
download | flex-git-dd60560bfd804f430924647bab625f9e887c367d.tar.gz |
Refactor filter.c to use line_directive_out().
To make this work, use line_directive_out() had to be servered from
its deoendence on hidden globaks. Which was a good idea anyway,
No diffs in generated test code from this commit.
Yet another well-hidden C assumption. I begin to woner if I will
expire of old age before fkushing out all of these.
Diffstat (limited to 'src/misc.c')
-rw-r--r-- | src/misc.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -262,9 +262,8 @@ void lerr_fatal (const char *msg, ...) } -/* line_directive_out - spit out a "#line" statement */ - -void line_directive_out (FILE *output_file, int do_infile) +/* line_directive_out - spit out a "#line" statement or equivalent */ +void line_directive_out (FILE *output_file, char *path, int linenum) { char *trace_fmt = "m4_ifdef([[M4_HOOK_TRACE_LINE_FORMAT]], [[M4_HOOK_TRACE_LINE_FORMAT([[%d]], [[%s]])]])"; char directive[MAXLINE*2], filename[MAXLINE]; @@ -273,9 +272,9 @@ void line_directive_out (FILE *output_file, int do_infile) if (!ctrl.gen_line_dirs) return; - s1 = do_infile ? infilename : "M4_YY_OUTFILE_NAME"; + s1 = (path != NULL) ? path : "M4_YY_OUTFILE_NAME"; - if (do_infile && !s1) + if ((path != NULL) && !s1) s1 = "<stdin>"; s2 = filename; @@ -291,7 +290,7 @@ void line_directive_out (FILE *output_file, int do_infile) *s2 = '\0'; - if (do_infile) + if (path != NULL) snprintf (directive, sizeof(directive), trace_fmt, linenum, filename); else { snprintf (directive, sizeof(directive), trace_fmt, 0, filename); |