From 3b7633c2cb47e2b378a77441b078f462941a6336 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Mon, 9 Mar 2026 23:23:15 +0900 Subject: [PATCH] fix --- include/xemil.h | 10 ++++++++-- src/core.c | 16 ++++++++-------- src/xinclude.c | 3 +-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/include/xemil.h b/include/xemil.h index 9dfe7cb..5f25b6d 100644 --- a/include/xemil.h +++ b/include/xemil.h @@ -14,6 +14,7 @@ typedef struct xl_driver xl_driver_t; typedef struct xemil xemil_t; typedef struct xl_node xl_node_t; typedef struct xl_attribute xl_attribute_t; +typedef struct xl_param xl_param_t; #define XL_SKIPPABLE(x) (((x) == ' ') || ((x) == '\t') || ((x) == '\n') || ((x) == '\r')) @@ -53,15 +54,20 @@ struct xl_node { xl_node_t* next; }; +struct xl_param { + int new_text; + int do_xinclude; +}; + struct xemil { xl_driver_t* driver; void* drv_opaque; void* drv_arg; - int new_text; - int do_xinclude; char* path; xl_node_t* pre; xl_node_t* root; + + xl_param_t param; }; #ifdef __cplusplus diff --git a/src/core.c b/src/core.c index c2ffc4f..e45abf5 100644 --- a/src/core.c +++ b/src/core.c @@ -12,8 +12,8 @@ xemil_t* xl_open(xl_driver_t* driver, void* arg) { handle->path = NULL; - handle->new_text = 0; - handle->do_xinclude = 0; + handle->param.new_text = 0; + handle->param.do_xinclude = 0; if(!handle->driver->open(handle)) { free(handle); @@ -213,7 +213,7 @@ int xl_parse(xemil_t* handle) { char* text; xl_node_t* last; - if(handle->new_text) { + if(handle->param.new_text) { old = NULL; last = current->first_child; @@ -241,7 +241,7 @@ int xl_parse(xemil_t* handle) { text[strlen(text) - 2] = 0; } - if(handle->new_text) { + if(handle->param.new_text) { if(last == NULL) { xl_node_t* n; @@ -289,7 +289,7 @@ int xl_parse(xemil_t* handle) { nest_level--; - if(handle->new_text) { + if(handle->param.new_text) { xl_node_t* n = current->first_child; if(current->text != NULL) free(current->text); @@ -493,7 +493,7 @@ int xl_parse(xemil_t* handle) { char* old; xl_node_t* last; - if(handle->new_text) { + if(handle->param.new_text) { old = NULL; last = current->first_child; @@ -529,7 +529,7 @@ int xl_parse(xemil_t* handle) { text[new] = 0; } - if(handle->new_text) { + if(handle->param.new_text) { if(last == NULL) { xl_node_t* n; @@ -563,7 +563,7 @@ int xl_parse(xemil_t* handle) { CLEANUP; - if(handle->do_xinclude) { + if(handle->param.do_xinclude) { xl_xinclude_scan(handle, handle->root); } diff --git a/src/xinclude.c b/src/xinclude.c index e556b36..6d61e1e 100644 --- a/src/xinclude.c +++ b/src/xinclude.c @@ -21,8 +21,7 @@ void xl_xinclude_scan(xemil_t* handle, xl_node_t* node) { if(xpointer == NULL) xpointer = "element(/)"; if((new = xl_open_file(href)) != NULL) { - new->do_xinclude = 1; - new->new_text = handle->new_text; + new->param = handle->param; if(xl_parse(new) && new->root != NULL) { xl_node_t** nodes; if((nodes = xl_xpointer(new->root, xpointer)) != NULL) {