[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (do_jslice
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (do_jslicenses_file): use file_name_is_absolute. |
Date: |
Sat, 18 Jan 2025 16:17:34 -0500 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 6ff5b658fa * tp/Texinfo/XS/convert/convert_html.c
(do_jslicenses_file): use file_name_is_absolute.
6ff5b658fa is described below
commit 6ff5b658fac7e6ac4fee47d881102231a59e0bf7
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jan 18 22:17:36 2025 +0100
* tp/Texinfo/XS/convert/convert_html.c (do_jslicenses_file): use
file_name_is_absolute.
* tp/Texinfo/XS/main/utils.c (canonpath, add_include_directory): use
file names portability macros.
* tp/Texinfo/XS/parsetexi/input.c (input_push_file): use
parse_file_path to get base_filename.
* tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): rename
sys_filename as file_path.
---
ChangeLog | 14 ++++++++++++++
tp/Texinfo/XS/convert/convert_html.c | 2 +-
tp/Texinfo/XS/main/utils.c | 12 ++++++------
tp/Texinfo/XS/parsetexi/end_line.c | 12 ++++++------
tp/Texinfo/XS/parsetexi/input.c | 29 +++++++----------------------
5 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d846752964..3f16bb64f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2025-01-18 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/convert_html.c (do_jslicenses_file): use
+ file_name_is_absolute.
+
+ * tp/Texinfo/XS/main/utils.c (canonpath, add_include_directory): use
+ file names portability macros.
+
+ * tp/Texinfo/XS/parsetexi/input.c (input_push_file): use
+ parse_file_path to get base_filename.
+
+ * tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): rename
+ sys_filename as file_path.
+
2025-01-18 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/texi2any.c (main): determine if the program is
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 53cc94fcce..fcb000e71b 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -2430,7 +2430,7 @@ do_jslicenses_file (CONVERTER *self)
if (!setting || strcmp (setting, "generate") || !path || !strlen (path))
return;
- if (!memcmp (path, "/", 1))
+ if (file_name_is_absolute (path))
path_not_ok = 1;
else
{
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index 7ade976d42..7223b688ff 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -843,7 +843,7 @@ char *
canonpath (const char *input_file)
{
TEXT result;
- const char *p = strchr (input_file, '/');
+ const char *p = strpbrk (input_file, FILE_SLASH);
if (p)
{
@@ -851,15 +851,15 @@ canonpath (const char *input_file)
text_append_n (&result, input_file, p - input_file);
while (1)
{
- const char *q;
+ const char *q = p;
p++;
- while (*p == '/')
+ while (IS_SLASH(*p))
p++;
/* omit a / at the end of the path */
if (!*p)
return (result.text);
- text_append_n (&result, "/", 1);
- q = strchr (p, '/');
+ text_append_n (&result, *q, 1);
+ q = strpbrk (p, FILE_SLASH);
if (q)
{
text_append_n (&result, p, q - p);
@@ -1174,7 +1174,7 @@ add_include_directory (const char *input_filename,
int len;
char *filename = strdup (input_filename);
len = strlen (filename);
- if (len > 0 && filename[len - 1] == '/')
+ if (len > 0 && IS_SLASH(filename[len - 1]))
filename[len - 1] = '\0';
add_string (filename, include_dirs_list);
free (filename);
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c
b/tp/Texinfo/XS/parsetexi/end_line.c
index 109fb7227f..7765b4afe1 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -1356,10 +1356,10 @@ end_line_misc_line (ELEMENT *current)
else if (current->e.c->cmd == CM_include)
{
int status;
- char *fullpath, *sys_filename;
+ char *fullpath, *file_path;
- sys_filename = encode_file_name (text);
- fullpath = parser_locate_include_file (sys_filename);
+ file_path = encode_file_name (text);
+ fullpath = parser_locate_include_file (file_path);
if (!fullpath)
{
@@ -1395,7 +1395,7 @@ end_line_misc_line (ELEMENT *current)
}
else if (current->e.c->cmd == CM_verbatiminclude)
{
- char *fullpath, *sys_filename;
+ char *fullpath, *file_path;
GLOBAL_INFO *global_info = &parsed_document->global_info;
if (global_info->input_encoding_name)
@@ -1403,8 +1403,8 @@ end_line_misc_line (ELEMENT *current)
global_info->input_encoding_name);
/* gather included file for 'included_files'. No errors, they
should be output by converters */
- sys_filename = encode_file_name (text);
- fullpath = parser_locate_include_file (sys_filename);
+ file_path = encode_file_name (text);
+ fullpath = parser_locate_include_file (file_path);
if (fullpath && access (fullpath, R_OK) == 0)
add_string (fullpath, &global_info->included_files);
free (fullpath);
diff --git a/tp/Texinfo/XS/parsetexi/input.c b/tp/Texinfo/XS/parsetexi/input.c
index 67ca957c33..2520dd4670 100644
--- a/tp/Texinfo/XS/parsetexi/input.c
+++ b/tp/Texinfo/XS/parsetexi/input.c
@@ -538,6 +538,7 @@ top_file_index (void)
}
+
char *
parser_locate_include_file (const char *filename)
{
@@ -550,9 +551,8 @@ int
input_push_file (const char *input_file_path)
{
FILE *stream = 0;
- const char *p, *q;
char *base_filename;
- const char *stored_file_path;
+ char *input_file_name_and_directory[2];
if (!strcmp (input_file_path, "-"))
stream = stdin;
@@ -570,29 +570,14 @@ input_push_file (const char *input_file_path)
fatal ("realloc failed");
}
- /* Strip off a leading directory path. */
- p = 0;
- q = strchr (input_file_path, '/');
- while (q)
- {
- p = q;
- q = strchr (q + 1, '/');
- }
-
- if (p)
- {
- base_filename = save_string (p+1);
- stored_file_path = save_string (input_file_path);
- }
- else
- {
- base_filename = save_string (input_file_path);
- stored_file_path = base_filename;
- }
+ parse_file_path (input_file_path, input_file_name_and_directory);
+ base_filename = save_string (input_file_name_and_directory[0]);
+ free (input_file_name_and_directory[0]);
+ free (input_file_name_and_directory[1]);
input_stack[input_number].type = IN_file;
input_stack[input_number].file = stream;
- input_stack[input_number].input_file_path = stored_file_path;
+ input_stack[input_number].input_file_path = save_string (input_file_path);
input_stack[input_number].source_info.file_name = base_filename;
input_stack[input_number].source_info.line_nr = 0;
input_stack[input_number].source_info.macro = 0;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/convert_html.c (do_jslicenses_file): use file_name_is_absolute.,
Patrice Dumas <=