]> granicus.if.org Git - flex/commitdiff
Remove unneeded tracking of line/column output; patch from Tim Landsheet scfc_de
authorWill Estes <wlestes@users.sourceforge.net>
Fri, 2 Mar 2012 21:44:21 +0000 (21:44 +0000)
committerWill Estes <wlestes@users.sourceforge.net>
Fri, 2 Mar 2012 21:44:21 +0000 (21:44 +0000)
flexdef.h
main.c
misc.c

index 572fe2ad49b3d4637d3bd980fe1d296e2dafe1f8..0e81410d260e14b936c8b8135da0a5a4190c7174 100644 (file)
--- a/flexdef.h
+++ b/flexdef.h
@@ -416,7 +416,6 @@ extern int yymore_really_used, reject_really_used;
  * dataline - number of contiguous lines of data in current data
  *     statement.  Used to generate readable -f output
  * linenum - current input line number
- * out_linenum - current output line number
  * skelfile - the skeleton file
  * skel - compiled-in skeleton array
  * skel_ind - index into "skel" array, if skelfile is nil
@@ -444,7 +443,7 @@ extern int yymore_really_used, reject_really_used;
  *     to "action_array"
  */
 
-extern int datapos, dataline, linenum, out_linenum;
+extern int datapos, dataline, linenum;
 extern FILE *skelfile, *yyin, *backing_up_file;
 extern const char *skel[];
 extern int skel_ind;
@@ -939,7 +938,6 @@ extern void out PROTO ((const char *));
 extern void out_dec PROTO ((const char *, int));
 extern void out_dec2 PROTO ((const char *, int, int));
 extern void out_hex PROTO ((const char *, unsigned int));
-extern void out_line_count PROTO ((const char *));
 extern void out_str PROTO ((const char *, const char *));
 extern void out_str3
 PROTO ((const char *, const char *, const char *, const char *));
diff --git a/main.c b/main.c
index fef16f400c3d35f5e9ed82e19285c799743f2827..31833c4f1ae07938b30130add74ee02a6b72dfde 100644 (file)
--- a/main.c
+++ b/main.c
@@ -57,7 +57,7 @@ int     C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap,
 int     reentrant, bison_bridge_lval, bison_bridge_lloc;
 int     yymore_used, reject, real_reject, continued_action, in_rule;
 int     yymore_really_used, reject_really_used;
-int     datapos, dataline, linenum, out_linenum;
+int     datapos, dataline, linenum;
 FILE   *skelfile = NULL;
 int     skel_ind = 0;
 char   *action_array;
@@ -1443,7 +1443,7 @@ void flexinit (argc, argv)
        num_backing_up = onesp = numprots = 0;
        variable_trailing_context_rules = bol_needed = false;
 
-       out_linenum = linenum = sectnum = 1;
+       linenum = sectnum = 1;
        firstprot = NIL;
 
        /* Used in mkprot() so that the first proto goes in slot 1
diff --git a/misc.c b/misc.c
index bf405cc063ba6a7afe0b4ab503875610880cda45..e3fdd50cdd9b599c0f4585163bda10dadc23cecd 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -456,11 +456,7 @@ void line_directive_out (output_file, do_infile)
        if (do_infile)
                snprintf (directive, sizeof(directive), line_fmt, linenum, filename);
        else {
-               if (output_file == stdout)
-                       /* Account for the line directive itself. */
-                       ++out_linenum;
-
-               snprintf (directive, sizeof(directive), line_fmt, out_linenum, filename);
+               snprintf (directive, sizeof(directive), line_fmt, 0, filename);
        }
 
        /* If output_file is nil then we should put the directive in
@@ -677,7 +673,6 @@ void out (str)
      const char *str;
 {
        fputs (str, stdout);
-       out_line_count (str);
 }
 
 void out_dec (fmt, n)
@@ -685,7 +680,6 @@ void out_dec (fmt, n)
      int n;
 {
        fprintf (stdout, fmt, n);
-       out_line_count (fmt);
 }
 
 void out_dec2 (fmt, n1, n2)
@@ -693,7 +687,6 @@ void out_dec2 (fmt, n1, n2)
      int n1, n2;
 {
        fprintf (stdout, fmt, n1, n2);
-       out_line_count (fmt);
 }
 
 void out_hex (fmt, x)
@@ -701,35 +694,18 @@ void out_hex (fmt, x)
      unsigned int x;
 {
        fprintf (stdout, fmt, x);
-       out_line_count (fmt);
-}
-
-void out_line_count (str)
-     const char *str;
-{
-       register int i;
-
-       for (i = 0; str[i]; ++i)
-               if (str[i] == '\n')
-                       ++out_linenum;
 }
 
 void out_str (fmt, str)
      const char *fmt, str[];
 {
        fprintf (stdout,fmt, str);
-       out_line_count (fmt);
-       out_line_count (str);
 }
 
 void out_str3 (fmt, s1, s2, s3)
      const char *fmt, s1[], s2[], s3[];
 {
        fprintf (stdout,fmt, s1, s2, s3);
-       out_line_count (fmt);
-       out_line_count (s1);
-       out_line_count (s2);
-       out_line_count (s3);
 }
 
 void out_str_dec (fmt, str, n)
@@ -737,17 +713,12 @@ void out_str_dec (fmt, str, n)
      int n;
 {
        fprintf (stdout,fmt, str, n);
-       out_line_count (fmt);
-       out_line_count (str);
 }
 
 void outc (c)
      int c;
 {
        fputc (c, stdout);
-
-       if (c == '\n')
-               ++out_linenum;
 }
 
 void outn (str)
@@ -755,8 +726,6 @@ void outn (str)
 {
        fputs (str,stdout);
     fputc('\n',stdout);
-       out_line_count (str);
-       ++out_linenum;
 }
 
 /** Print "m4_define( [[def]], [[val]])m4_dnl\n".