diff options
author | Hironobu Yamashita <h.y.acetaminophen@gmail.com> | 2023-01-19 14:15:46 +0000 |
---|---|---|
committer | Hironobu Yamashita <h.y.acetaminophen@gmail.com> | 2023-01-19 14:15:46 +0000 |
commit | c4b4a17dbc20d2faf23c0045c886e81121e4e44f (patch) | |
tree | 147235c39fb827d8b3cba3f277a1f41590a87c72 /Build/source/texk | |
parent | d52b28f54e9e80e65936946e4464c6114b8dce72 (diff) |
synctexdir: update from GH
git-svn-id: svn://tug.org/texlive/trunk@65582 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
5 files changed, 114 insertions, 33 deletions
diff --git a/Build/source/texk/web2c/synctexdir/ChangeLog b/Build/source/texk/web2c/synctexdir/ChangeLog index ede9fe64547..3867a486e71 100644 --- a/Build/source/texk/web2c/synctexdir/ChangeLog +++ b/Build/source/texk/web2c/synctexdir/ChangeLog @@ -1,3 +1,28 @@ +2023-01-19 Hironobu Yamashita <h.y.acetaminophen@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@t-lab.opal.ne.jp> * am/synctex.am: Remove ptex and uptex. diff --git a/Build/source/texk/web2c/synctexdir/synctex_main.c b/Build/source/texk/web2c/synctexdir/synctex_main.c index 788a7cee8e8..f6af5b98807 100644 --- a/Build/source/texk/web2c/synctexdir/synctex_main.c +++ b/Build/source/texk/web2c/synctexdir/synctex_main.c @@ -526,6 +526,7 @@ int synctex_view_proceed(synctex_view_params_t * Ps) { puts("SyncTeX result end"); } } + synctex_scanner_free(scanner); } return 0; } @@ -790,6 +791,7 @@ int synctex_edit_proceed(synctex_edit_params_t * Ps) { } } } + synctex_scanner_free(scanner); return 0; } diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser.c b/Build/source/texk/web2c/synctexdir/synctex_parser.c index 45124ea3bff..60988288b85 100644 --- a/Build/source/texk/web2c/synctexdir/synctex_parser.c +++ b/Build/source/texk/web2c/synctexdir/synctex_parser.c @@ -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 @@ __synctex_scanner_register_handle_to(NODE) 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 @@ static synctex_bool_t _synctex_tree_has_##WHAT(synctex_node_p node) {\ 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 @@ SYNCTEX_INLINE static synctex_node_p __synctex_tree_##WHAT(synctex_non_null_node } # 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 @@ DEFINE_SYNCTEX_TREE_RESET(WHAT) * 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_TREE_GETSETRESET(target) #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 @@ static void _synctex_free_node(synctex_node_p node) { * 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 @@ next_line: _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_scanner_p synctex_scanner_new_with_output_file(const char * output, cons _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 @@ synctex_scanner_p synctex_scanner_new_with_output_file(const char * output, cons 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 @@ synctex_scanner_p synctex_scanner_parse(synctex_scanner_p scanner) { 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 @@ synctex_scanner_p synctex_scanner_parse(synctex_scanner_p scanner) { 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 @@ struct synctex_updater_t { 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 @@ static int vasprintf(char **ret, /** * 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) { diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser_readme.md b/Build/source/texk/web2c/synctexdir/synctex_parser_readme.md index d47a89f5705..f706592d1f7 100644 --- a/Build/source/texk/web2c/synctexdir/synctex_parser_readme.md +++ b/Build/source/texk/web2c/synctexdir/synctex_parser_readme.md @@ -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. diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser_utils.c b/Build/source/texk/web2c/synctexdir/synctex_parser_utils.c index 4b4065dab64..bda378165f4 100644 --- a/Build/source/texk/web2c/synctexdir/synctex_parser_utils.c +++ b/Build/source/texk/web2c/synctexdir/synctex_parser_utils.c @@ -86,6 +86,7 @@ void _synctex_free(void * ptr) { # 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 @@ static int _synctex_log(int level, const char * prompt, const char * reason,va_l return result; } +__attribute__((__format__ (__printf__, 1, 2))) int _synctex_error(const char * reason,...) { va_list arg; int result; @@ -145,6 +147,7 @@ int _synctex_error(const char * reason,...) { return result; } +__attribute__((__format__ (__printf__, 1, 2))) int _synctex_debug(const char * reason,...) { va_list arg; int result; |