[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Fri, 2 Feb 2024 16:40:41 -0500 (EST) |
branch: master
commit e323fae62779e81b9e792c1f4875c676d30c7915
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Feb 2 22:40:32 2024 +0100
* tp/Texinfo/XS/main/document.c
(unregister_document_merge_with_document): merge
unregister_document_descriptor_tree in
unregister_document_merge_with_document. Remove TREE_AND_STRINGS.
---
ChangeLog | 7 +++++
tp/Texinfo/XS/convert/convert_html.c | 2 +-
tp/Texinfo/XS/main/document.c | 54 +++++++++++++-----------------------
tp/Texinfo/XS/main/document.h | 6 ----
4 files changed, 27 insertions(+), 42 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1b81be0f70..d82b6198b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-02-02 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/document.c
+ (unregister_document_merge_with_document): merge
+ unregister_document_descriptor_tree in
+ unregister_document_merge_with_document. Remove TREE_AND_STRINGS.
+
2024-02-02 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/main/document.c
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index c8a1b612dc..36af3b1b7e 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -49,7 +49,7 @@
#include "convert_to_text.h"
#include "call_perl_function.h"
#include "call_html_perl_function.h"
-/* for TREE_AND_STRINGS */
+/* for unregister_document_merge_with_document */
#include "document.h"
/* for OTXI_UNICODE_TEXT_CASES */
#include "unicode.h"
diff --git a/tp/Texinfo/XS/main/document.c b/tp/Texinfo/XS/main/document.c
index 75ea68080d..b8531574a4 100644
--- a/tp/Texinfo/XS/main/document.c
+++ b/tp/Texinfo/XS/main/document.c
@@ -218,59 +218,43 @@ remove_document_descriptor (int document_descriptor)
*/
}
-/* destroy everything except for the tree, and small strings
- and unregister the tree such that it won't ever be retrieved.
- Should be used when the tree becomes part of another document,
- for instance */
-TREE_AND_STRINGS *
-unregister_document_descriptor_tree (int document_descriptor)
+/* destroy everything except for the tree and merge small string to
+ DOCUMENT */
+ELEMENT *
+unregister_document_merge_with_document (int document_descriptor,
+ DOCUMENT *document)
{
- TREE_AND_STRINGS *tree_and_strings = 0;
- DOCUMENT *document = retrieve_document (document_descriptor);
+ DOCUMENT *removed_document = retrieve_document (document_descriptor);
+ ELEMENT *tree;
- if (!document)
+ if (!removed_document)
return 0;
- tree_and_strings = malloc (sizeof (TREE_AND_STRINGS));
+ destroy_document_information_except_tree (removed_document);
- destroy_document_information_except_tree (document);
- tree_and_strings->tree = document->tree;
- tree_and_strings->small_strings = document->small_strings;
+ tree = removed_document->tree;
+ removed_document->tree = 0;
- document->tree = 0;
- document->small_strings = 0;
/*
- fprintf(stderr, "UNREGISTER %p\n", document);
+ fprintf(stderr, "UNREGISTER %p\n", removed_document);
*/
- return tree_and_strings;
-}
-/* destroy everything except for the tree and merge small string to
- DOCUMENT */
-ELEMENT *
-unregister_document_merge_with_document (int document_descriptor,
- DOCUMENT *document)
-{
- TREE_AND_STRINGS *tree_and_strings
- = unregister_document_descriptor_tree (document_descriptor);
-
- ELEMENT *tree = tree_and_strings->tree;
-
- if (tree_and_strings->small_strings)
+ if (removed_document->small_strings)
{
- if (tree_and_strings->small_strings->number)
+ if (removed_document->small_strings->number)
{
if (document)
merge_strings (document->small_strings,
- tree_and_strings->small_strings);
+ removed_document->small_strings);
else
fatal ("unregister_document_merge_with_document "
"no document but small_strings");
}
- free (tree_and_strings->small_strings->list);
- free (tree_and_strings->small_strings);
+ free (removed_document->small_strings->list);
+ free (removed_document->small_strings);
+
+ removed_document->small_strings = 0;
}
- free (tree_and_strings);
return tree;
}
diff --git a/tp/Texinfo/XS/main/document.h b/tp/Texinfo/XS/main/document.h
index cfd685db21..3359b20c41 100644
--- a/tp/Texinfo/XS/main/document.h
+++ b/tp/Texinfo/XS/main/document.h
@@ -9,11 +9,6 @@
#include "tree_types.h"
#include "document_types.h"
-typedef struct TREE_AND_STRINGS {
- ELEMENT *tree;
- STRING_LIST *small_strings;
-} TREE_AND_STRINGS;
-
struct TEXT_OPTIONS;
@@ -38,7 +33,6 @@ void register_document_convert_index_text_options (DOCUMENT
*document,
const MERGED_INDICES *document_merged_indices (DOCUMENT *document);
void remove_document_descriptor (int document_descriptor);
-TREE_AND_STRINGS *unregister_document_descriptor_tree (int
document_descriptor);
ELEMENT *unregister_document_merge_with_document (int document_descriptor,
DOCUMENT *document);
void clear_document_errors (int document_descriptor);