]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
xgettext: Make JavaScript parser more robust.
authorBruno Haible <bruno@clisp.org>
Sun, 7 Apr 2019 23:52:20 +0000 (01:52 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 7 Apr 2019 23:52:20 +0000 (01:52 +0200)
* gettext-tools/src/x-javascript.c (extract_javascript): Initialize
inside_embedded_js_in_xml.

gettext-tools/src/x-javascript.c

index d6d563d094c883d72778029311ab9880141f1664..88bc55349ff08f36b12e8e9dfd34c47c38fa4c40 100644 (file)
@@ -899,8 +899,9 @@ phase5_scan_regexp (void)
       phase2_ungetc (c);
 }
 
-static int xml_element_depth = 0;
-static bool inside_embedded_js_in_xml = false;
+/* Number of open XML elements.  */
+static int xml_element_depth;
+static bool inside_embedded_js_in_xml;
 
 static bool
 phase5_scan_xml_markup (token_ty *tp)
@@ -1563,6 +1564,7 @@ extract_javascript (FILE *f,
   last_non_comment_line = -1;
 
   xml_element_depth = 0;
+  inside_embedded_js_in_xml = false;
 
   xgettext_current_file_source_encoding = xgettext_global_source_encoding;
 #if HAVE_ICONV