fix some bug
This commit is contained in:
parent
e5b592e29a
commit
d0f2fc6c1c
3 changed files with 16 additions and 2 deletions
|
|
@ -81,6 +81,8 @@ XLDECL xemil_t* xl_open_file(const char* filename);
|
|||
/* util.c */
|
||||
XLDECL char* xl_util_trim(const char* str);
|
||||
|
||||
XLDECL char* xl_util_strdup(const char* str);
|
||||
|
||||
/* unicode.c */
|
||||
XLDECL int xl_unicode_count(unsigned char c);
|
||||
|
||||
|
|
|
|||
|
|
@ -293,6 +293,8 @@ int xl_parse(xemil_t* handle) {
|
|||
n->text = str;
|
||||
|
||||
if(strlen(n->text) == 0) {
|
||||
xl_node_t* o = n;
|
||||
|
||||
free(n->text);
|
||||
n->text = NULL;
|
||||
|
||||
|
|
@ -300,9 +302,9 @@ int xl_parse(xemil_t* handle) {
|
|||
if(n->next != NULL) n->next->prev = n->prev;
|
||||
|
||||
n = n->next;
|
||||
if(n != NULL) free(n->prev);
|
||||
free(o);
|
||||
|
||||
if(n->prev == NULL) n->parent->first_child = n;
|
||||
if(n != NULL && n->prev == NULL && n->parent != NULL) n->parent->first_child = n;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
@ -480,6 +482,8 @@ int xl_parse(xemil_t* handle) {
|
|||
|
||||
if(last->type == XL_NODE_TEXT){
|
||||
old = last->text;
|
||||
}else{
|
||||
last = NULL;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -74,3 +74,11 @@ char* xl_util_trim(const char* str) {
|
|||
|
||||
return s;
|
||||
}
|
||||
|
||||
char* xl_util_strdup(const char* str){
|
||||
char* s = malloc(strlen(str) + 1);
|
||||
|
||||
strcpy(s, str);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue