[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Sat, 24 Feb 2024 17:26:11 -0500 (EST) |
branch: master
commit 21b34cc8c8eb0ae736ade206636b0e8d0a6fb912
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Feb 24 23:25:58 2024 +0100
* tp/Texinfo/XS/convert/convert_html.c (set_file_source_info)
(html_destroy_files_source_info, html_set_pages_files),
tp/Texinfo/XS/main/utils.h (FILE_SOURCE_INFO): free filepath coming
from user-defined file_id_setting unit_file_name function.
Copy filepath in FILE_SOURCE_INFO.
---
ChangeLog | 8 ++++++++
tp/Texinfo/XS/convert/convert_html.c | 9 ++++++---
tp/Texinfo/XS/main/utils.h | 2 +-
tp/t/init/set_unit_file_name_filepath.pm | 2 +-
tp/t/results/html_tests/set_unit_file_name_filepath.pl | 2 +-
5 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f96d445499..7cf876848c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-02-24 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/convert_html.c (set_file_source_info)
+ (html_destroy_files_source_info, html_set_pages_files),
+ tp/Texinfo/XS/main/utils.h (FILE_SOURCE_INFO): free filepath coming
+ from user-defined file_id_setting unit_file_name function.
+ Copy filepath in FILE_SOURCE_INFO.
+
2024-02-24 Patrice Dumas <pertusus@free.fr>
* tp/Makefile.am (test_files),
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 56fe0d414e..d5aba515cf 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -5186,7 +5186,10 @@ set_file_source_info (FILE_SOURCE_INFO *file_source_info,
file_source_info->type = file_info_type;
file_source_info->name = file_info_name;
file_source_info->element = file_info_element;
- file_source_info->path = filepath;
+ if (filepath)
+ file_source_info->path = strdup (filepath);
+ else
+ file_source_info->path = 0;
}
static FILE_SOURCE_INFO *
@@ -5237,6 +5240,7 @@ html_destroy_files_source_info (FILE_SOURCE_INFO_LIST
*files_source_info)
for (i = 0; i < files_source_info->number; i++)
{
free (files_source_info->list[i].filename);
+ free (files_source_info->list[i].path);
}
free (files_source_info->list);
free (files_source_info);
@@ -5562,8 +5566,6 @@ html_set_pages_files (CONVERTER *self, const
OUTPUT_UNIT_LIST *output_units,
FILE_SOURCE_INFO *file_source_info
= find_file_source_info (files_source_info,
file_name_path->filename);
- /* FIXME to check, but seems like if file_name_path->filepath
- is set, it will not be freed */
if (file_source_info)
{
if (file_source_info->path && file_name_path->filepath
@@ -5588,6 +5590,7 @@ html_set_pages_files (CONVERTER *self, const
OUTPUT_UNIT_LIST *output_units,
free (filename);
filename = file_name_path->filename;
}
+ free (file_name_path->filepath);
free (file_name_path);
}
output_unit_file_idx
diff --git a/tp/Texinfo/XS/main/utils.h b/tp/Texinfo/XS/main/utils.h
index 62380b12e2..7d3e1474b8 100644
--- a/tp/Texinfo/XS/main/utils.h
+++ b/tp/Texinfo/XS/main/utils.h
@@ -132,7 +132,7 @@ typedef struct FILE_SOURCE_INFO {
const char *type;
const char *name;
const ELEMENT *element;
- const char *path;
+ char *path;
} FILE_SOURCE_INFO;
typedef struct FILE_SOURCE_INFO_LIST {
diff --git a/tp/t/init/set_unit_file_name_filepath.pm
b/tp/t/init/set_unit_file_name_filepath.pm
index d3d2e9e640..43ebb41e0a 100644
--- a/tp/t/init/set_unit_file_name_filepath.pm
+++ b/tp/t/init/set_unit_file_name_filepath.pm
@@ -1,7 +1,7 @@
use strict;
texinfo_register_file_id_setting_function('unit_file_name',
-
\&test_set_unit_file_name_filepath_file_name);
+ \&test_set_unit_file_name_filepath_file_name);
sub test_set_unit_file_name_filepath_file_name($$$$)
{
diff --git a/tp/t/results/html_tests/set_unit_file_name_filepath.pl
b/tp/t/results/html_tests/set_unit_file_name_filepath.pl
index 50e8b7dd54..c69cafb213 100644
--- a/tp/t/results/html_tests/set_unit_file_name_filepath.pl
+++ b/tp/t/results/html_tests/set_unit_file_name_filepath.pl
@@ -257,7 +257,7 @@ $result_menus{'set_unit_file_name_filepath'} = [
}
];
-$result_errors{'set_unit_file_name_filepath'} = undef;
+$result_errors{'set_unit_file_name_filepath'} = [];
$result_floats{'set_unit_file_name_filepath'} = {};