1
0
Fork 0

[libdom] Free keyboard and dom related strings

This commit is contained in:
Witold Filipczyk 2024-05-12 18:52:27 +02:00
parent 8a2e85b73f
commit 5c92b4ee96
5 changed files with 27 additions and 15 deletions

View File

@ -274,8 +274,8 @@ static enum {
static lwc_string *keyb_lwc[KEYB_COUNT];
static void
initialize_keyb(void)
void
keybstrings_init(void)
{
int i;
@ -284,13 +284,12 @@ initialize_keyb(void)
if (err != lwc_error_ok) {
return;
//return _dom_exception_from_lwc_error(err);
}
}
}
static void
finalize_keyb(void)
void
keybstrings_fini(void)
{
int i;
@ -304,12 +303,6 @@ finalize_keyb(void)
unicode_val_T
convert_dom_string_to_keycode(dom_string *dom_key)
{
static int initialized = 0;
if (!initialized) {
initialize_keyb();
initialized = 1;
}
if (!dom_key) {
return 0;
}

View File

@ -18,6 +18,8 @@ void *el_match_selector(const char *selector, void *node);
void add_lowercase_to_string(struct string *buf, const char *str, int len);
bool convert_key_to_dom_string(term_event_key_T key, dom_string **res);
unicode_val_T convert_dom_string_to_keycode(dom_string *dom_key);
void keybstrings_init(void);
void keybstrings_fini(void);
#ifdef __cplusplus
}

View File

@ -24,6 +24,7 @@
#include "util/hash.h"
#include "util/string.h"
static int libdom_initialised = 0;
static int in_script = 0;
static bool
@ -264,11 +265,10 @@ walk_tree(void *mapa, void *mapa_rev, struct string *buf, dom_node *node, bool s
void
render_xhtml_document(struct cache_entry *cached, struct document *document, struct string *buffer)
{
static int initialised = 0;
if (!initialised) {
if (!libdom_initialised) {
corestrings_init();
initialised = 1;
keybstrings_init();
libdom_initialised = 1;
}
if (!document->dom) {
@ -298,6 +298,15 @@ render_xhtml_document(struct cache_entry *cached, struct document *document, str
dump_xhtml(cached, document, 0);
}
void
free_libdom(void)
{
if (libdom_initialised) {
keybstrings_fini();
corestrings_fini();
}
}
#if 0
static void
walk_tree2(struct document *document, dom_node *node)

View File

@ -19,6 +19,8 @@ struct node_rect {
void render_xhtml_document(struct cache_entry *cached, struct document *document, struct string *buffer);
void dump_xhtml(struct cache_entry *cached, struct document *document, int parse);
void free_libdom(void);
#if 0
void walk2(struct document *document);
void scan_document(struct document_view *doc_view);

View File

@ -29,6 +29,9 @@
#include "config/options.h"
#include "dialogs/menu.h"
#include "document/document.h"
#ifdef CONFIG_LIBDOM
#include "document/libdom/renderer2.h"
#endif
#include "intl/charsets.h"
#include "intl/libintl.h"
#include "main/event.h"
@ -327,6 +330,9 @@ terminate_all_subsystems(void)
terminate_osdep();
#ifdef CONFIG_COMBINE
free_combined();
#endif
#ifdef CONFIG_LIBDOM
free_libdom();
#endif
clean_temporary_files();
}