texlive[65582] Build/source/texk/web2c/synctexdir: synctexdir: update

commits+hironobu at tug.org commits+hironobu at tug.org
Thu Jan 19 15:15:46 CET 2023


Revision: 65582
          http://tug.org/svn/texlive?view=revision&revision=65582
Author:   hironobu
Date:     2023-01-19 15:15:46 +0100 (Thu, 19 Jan 2023)
Log Message:
-----------
synctexdir: update from GH

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/synctexdir/ChangeLog
    trunk/Build/source/texk/web2c/synctexdir/synctex_main.c
    trunk/Build/source/texk/web2c/synctexdir/synctex_parser.c
    trunk/Build/source/texk/web2c/synctexdir/synctex_parser_readme.md
    trunk/Build/source/texk/web2c/synctexdir/synctex_parser_utils.c

Modified: trunk/Build/source/texk/web2c/synctexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/ChangeLog	2023-01-19 00:49:44 UTC (rev 65581)
+++ trunk/Build/source/texk/web2c/synctexdir/ChangeLog	2023-01-19 14:15:46 UTC (rev 65582)
@@ -1,3 +1,28 @@
+2023-01-19  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	Comparing TL r55094 (by JL) and GH 2020 branch.
+
+	  * Changed files (on https://github.com/jlaurens/synctex):
+	    synctex_main.c
+	    synctex_parser.c
+	    synctex_parser_readme.md
+	    synctex_parser_utils.c
+
+	  - Fix compilation with clang with -Wformat-nonliteral.
+	    https://github.com/jlaurens/synctex/pull/38
+	  - Fix build when compiling with -Werror=implicit-function-declaration.
+	    https://github.com/jlaurens/synctex/pull/39
+	  - More explanations.
+	  - Remove recursion form _synctex_free_handle_old.
+	  - Fix a Bug in post scriptum parser y_offset.
+	    https://github.com/jlaurens/synctex/issues/50
+	  - Fix a Memory leak when opening files.
+	    https://github.com/jlaurens/synctex/issues/49
+	  - Fix memleaks when a file cannot be parsed.
+	    https://github.com/jlaurens/synctex/issues/48
+	  - Fix memleaks when freeing iterators
+	    https://github.com/jlaurens/synctex/issues/55
+
 2023-01-15  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
 
 	* am/synctex.am: Remove ptex and uptex.

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex_main.c
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex_main.c	2023-01-19 00:49:44 UTC (rev 65581)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex_main.c	2023-01-19 14:15:46 UTC (rev 65582)
@@ -526,6 +526,7 @@
                 puts("SyncTeX result end");
             }
         }
+        synctex_scanner_free(scanner);
     }
     return 0;
 }
@@ -790,6 +791,7 @@
             }
         }
     }
+    synctex_scanner_free(scanner);
     return 0;
 }
 

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex_parser.c
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex_parser.c	2023-01-19 00:49:44 UTC (rev 65581)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex_parser.c	2023-01-19 14:15:46 UTC (rev 65582)
@@ -83,6 +83,11 @@
  *  First level objects are sheets and forms, containing boxes, glues, kerns...
  *  The third tree allows to browse leaves according to tag and line.
  */
+/* Declare _GNU_SOURCE for accessing vasprintf. For MSC compiler, vasprintf is
+ * defined in this file
+ */
+#define _GNU_SOURCE
+
 #   if defined(SYNCTEX_USE_LOCAL_HEADER)
 #       include "synctex_parser_local.h"
 #   else
@@ -361,7 +366,7 @@
 static synctex_bool_t _synctex_tree_has_##WHAT(synctex_node_p node) {\
     if (node) {\
         if (node->class_->navigator->WHAT>=0) {\
-            return  synctex_YES; \
+            return synctex_YES; \
         } else {\
             printf("WARNING: NO tree %s for %s\n", #WHAT, synctex_node_isa(node));\
         }\
@@ -369,9 +374,9 @@
     return synctex_NO;\
 }
 #else
-#define SYNCTEX_PARAMETER_ASSERT(WHAT)
-#define DEFINE_SYNCTEX_TREE_HAS(WHAT) \
-static synctex_bool_t _synctex_tree_has_##WHAT(synctex_node_p node) {\
+#   define SYNCTEX_PARAMETER_ASSERT(WHAT)
+#   define DEFINE_SYNCTEX_TREE_HAS(WHAT) \
+SYNCTEX_INLINE static synctex_bool_t _synctex_tree_has_##WHAT(synctex_node_p node) {\
     return (node && (node->class_->navigator->WHAT>=0));\
 }
 #endif
@@ -382,7 +387,7 @@
 }
 #   define DEFINE_SYNCTEX_TREE_GET(WHAT) \
 DEFINE_SYNCTEX_TREE__GET(WHAT) \
-static synctex_node_p _synctex_tree_##WHAT(synctex_node_p node) {\
+SYNCTEX_INLINE static synctex_node_p _synctex_tree_##WHAT(synctex_node_p node) {\
     if (_synctex_tree_has_##WHAT(node)) {\
         return __synctex_tree_##WHAT(node);\
     }\
@@ -438,10 +443,31 @@
  *  The return value of _synctex_tree_set_child and 
  *  _synctex_tree_set_sibling must be released somehow.
  */
+/* The next macro call creates:
+ SYNCTEX_INLINE static synctex_node_p __synctex_tree_sibling(synctex_node_p node)
+ SYNCTEX_INLINE static synctex_node_p __synctex_tree_set_sibling(synctex_node_p node, synctex_node_p new_value)
+ SYNCTEX_INLINE static synctex_node_p __synctex_tree_reset_sibling(synctex_node_p node)
+ */
 DEFINE_SYNCTEX_TREE__GETSETRESET(sibling)
+/* The next macro call creates:
+ SYNCTEX_INLINE static synctex_bool_t _synctex_tree_has_parent(synctex_node_p node);
+ SYNCTEX_INLINE static synctex_node_p __synctex_tree_parent(synctex_non_null_node_p node);
+ SYNCTEX_INLINE static synctex_node_p _synctex_tree_parent(synctex_node_p node);
+ SYNCTEX_INLINE static synctex_node_p __synctex_tree_set_parent(synctex_node_p node, synctex_node_p new_value);
+ SYNCTEX_INLINE static synctex_node_p _synctex_tree_set_parent(synctex_node_p node, synctex_node_p new_value);
+ SYNCTEX_INLINE static synctex_node_p __synctex_tree_reset_parent(synctex_node_p node);
+ SYNCTEX_INLINE static synctex_node_p _synctex_tree_reset_parent(synctex_node_p node);
+ */
 DEFINE_SYNCTEX_TREE_GETSETRESET(parent)
 DEFINE_SYNCTEX_TREE_GETSETRESET(child)
 DEFINE_SYNCTEX_TREE_GETSETRESET(friend)
+/* The next macro call creates:
+ SYNCTEX_INLINE static synctex_bool_t _synctex_tree_has_last(synctex_node_p node);
+ SYNCTEX_INLINE static synctex_node_p __synctex_tree_last(synctex_non_null_node_p node);
+ SYNCTEX_INLINE static synctex_node_p _synctex_tree_last(synctex_node_p node);
+ SYNCTEX_INLINE static synctex_node_p __synctex_tree_set_last(synctex_node_p node, synctex_node_p new_value);
+ SYNCTEX_INLINE static synctex_node_p _synctex_tree_set_last(synctex_node_p node, synctex_node_p new_value);
+ */
 DEFINE_SYNCTEX_TREE_GETSET(last)
 DEFINE_SYNCTEX_TREE_GETSET(next_hbox)
 DEFINE_SYNCTEX_TREE_GETSET(arg_sibling)
@@ -470,7 +496,7 @@
 
 #define SYNCTEX_HAS_CHILDREN(NODE) (NODE && _synctex_tree_child(NODE))
 #	ifdef	__SYNCTEX_WORK__
-#		include "/usr/include/zlib.h"
+#		include "/usr/local/include/node/zlib.h"
 #	else
 #		include <zlib.h>
 #	endif
@@ -892,13 +918,39 @@
  *  It is not owned by its parent, unless it is its first child.
  *  This destructor is for all handles.
  */
+static void _synctex_free_handle_old(synctex_node_p handle) {
+  if (handle) {
+    _synctex_free_handle_old(__synctex_tree_sibling(handle));
+    _synctex_free_handle_old(_synctex_tree_child(handle));
+    _synctex_free(handle);
+  }
+  return;
+}
 static void _synctex_free_handle(synctex_node_p handle) {
-    if (handle) {
-        _synctex_free_handle(__synctex_tree_sibling(handle));
-        _synctex_free_handle(_synctex_tree_child(handle));
-        _synctex_free(handle);
+  if (handle) {
+    synctex_node_p n = handle;
+    synctex_node_p nn;
+    __synctex_tree_set_parent(n, NULL);
+  down:
+    while ((nn = _synctex_tree_child(n))) {
+      __synctex_tree_set_parent(nn, n);
+      n = nn;
+    };
+  right:
+    nn = __synctex_tree_sibling(n);
+    if (nn) {
+      _synctex_free(n);
+      n = nn;
+      goto down;
     }
-    return;
+    nn = __synctex_tree_parent(n);
+    _synctex_free(n);
+    if (nn) {
+      n = nn;
+      goto right;
+    }
+  }
+  return;
 }
 
 /**
@@ -4510,7 +4562,7 @@
             _synctex_error("Problem with Y offset in the Post Scriptum.");
             return fs.status;
         }
-        scanner->x_offset = fs.value;
+        scanner->y_offset = fs.value;
         goto next_line;
     } else if (status<SYNCTEX_STATUS_EOF){
         goto report_record_problem;
@@ -6006,11 +6058,12 @@
         _synctex_error("malloc problem");
         return NULL;
     }
-    if ((scanner->reader = synctex_reader_init_with_output_file(scanner->reader, output, build_directory))) {
+    if (synctex_reader_init_with_output_file(scanner->reader, output, build_directory)) {
         return parse? synctex_scanner_parse(scanner):scanner;
     }
     // don't warn to terminal if no file is present, this is a library.
     // _synctex_error("No file?");
+    synctex_scanner_free(scanner);
     return NULL;
 }
 
@@ -6019,10 +6072,6 @@
 int synctex_scanner_free(synctex_scanner_p scanner) {
     int node_count = 0;
     if (scanner) {
-        if (SYNCTEX_FILE) {
-            gzclose(SYNCTEX_FILE);
-            SYNCTEX_FILE = NULL;
-        }
         synctex_node_free(scanner->sheet);
         synctex_node_free(scanner->form);
         synctex_node_free(scanner->input);
@@ -6054,17 +6103,6 @@
     scanner->x_offset = scanner->y_offset = 6.027e23f;
     scanner->reader->line_number = 1;
     
-    SYNCTEX_START = (char *)malloc(SYNCTEX_BUFFER_SIZE+1); /*  one more character for null termination */
-    if (NULL == SYNCTEX_START) {
-        _synctex_error("!  malloc error in synctex_scanner_parse.");
-    bailey:
-#ifdef SYNCTEX_DEBUG
-        return scanner;
-#else
-        synctex_scanner_free(scanner);
-        return NULL;
-#endif
-    }
     synctex_scanner_set_display_switcher(scanner, 1000);
     SYNCTEX_END = SYNCTEX_START+SYNCTEX_BUFFER_SIZE;
     /*  SYNCTEX_END always points to a null terminating character.
@@ -6078,7 +6116,13 @@
     status = _synctex_scan_preamble(scanner);
     if (status<SYNCTEX_STATUS_OK) {
         _synctex_error("Bad preamble\n");
-        goto bailey;
+        bailey:
+#ifdef SYNCTEX_DEBUG
+            return scanner;
+#else
+            synctex_scanner_free(scanner);
+            return NULL;
+#endif
     }
     status = _synctex_scan_content(scanner);
     if (status<SYNCTEX_STATUS_OK) {
@@ -8390,6 +8434,7 @@
     int length;             /*  the number of chars appended */
 };
 
+__attribute__((__format__ (__printf__, 2, 3)))
 static int _synctex_updater_print(synctex_updater_p updater, const char * format, ...) {
     int result = 0;
     if (updater) {
@@ -8426,6 +8471,7 @@
 /**
  *  gzvprintf is not available until OSX 10.10
  */
+__attribute__((__format__ (__printf__, 2, 3)))
 static int _synctex_updater_print_gz(synctex_updater_p updater, const char * format, ...) {
     int result = 0;
     if (updater) {

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex_parser_readme.md
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex_parser_readme.md	2023-01-19 00:49:44 UTC (rev 65581)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex_parser_readme.md	2023-01-19 14:15:46 UTC (rev 65582)
@@ -2,15 +2,20 @@
 
 This file is part of the __SyncTeX__ package.
 
-[//]: # (Version: 1.21)
-[//]: # (Date: Sun Oct 15 15:09:55 UTC 2017)
+[//]: # (Version: 1.22)
+[//]: # (Date: Mon May 11 16:05:02 UTC 2020)
 
 ## Important
 
+* Changes in version `1.22`
+
+  * Typos fixed in code and printed comments
+  * Code cleaning (`static` keyword added)
+  * Bug fixed (Missing `va_end`)
+
 * Changes in version `1.21`
 
-	* Display query returns more results (as much as `1.18`)
-	* Remove a `\` character from the name of 2 test files.
+	* Remove a `\` character from the name ot 2 test files.
 	* Change variable name `class` to `class_` because the former is a reserved keyword in C++.
 	* Adding a more portable unused variable management.
 	* Various cosmetic changes in the source code, including explicit declaration of `void` in forward function declaration.

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex_parser_utils.c
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex_parser_utils.c	2023-01-19 00:49:44 UTC (rev 65581)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex_parser_utils.c	2023-01-19 14:15:46 UTC (rev 65582)
@@ -86,6 +86,7 @@
 #   include <syslog.h>
 #endif
 
+__attribute__((__format__ (__printf__, 3, 0)))
 static int _synctex_log(int level, const char * prompt, const char * reason,va_list arg) {
 	int result;
 #	ifdef SYNCTEX_RECENT_WINDOWS
@@ -132,6 +133,7 @@
 	return result;
 }
 
+__attribute__((__format__ (__printf__, 1, 2)))
 int _synctex_error(const char * reason,...) {
     va_list arg;
     int result;
@@ -145,6 +147,7 @@
     return result;
 }
 
+__attribute__((__format__ (__printf__, 1, 2)))
 int _synctex_debug(const char * reason,...) {
     va_list arg;
     int result;



More information about the tex-live-commits mailing list.