diff --git a/src/dom/node.c b/src/dom/node.c index e0f336ce7..6f97cfb6a 100644 --- a/src/dom/node.c +++ b/src/dom/node.c @@ -331,7 +331,10 @@ get_dom_node_child(struct dom_node *parent, enum dom_node_type type, /* Nodes */ struct dom_node * -init_dom_node_(unsigned char *file, int line, +init_dom_node_at( +#ifdef DEBUG_MEMLEAK + unsigned char *file, int line, +#endif struct dom_node *parent, enum dom_node_type type, struct dom_string *string, int allocated) { diff --git a/src/dom/node.h b/src/dom/node.h index cb53614d4..fedebccf0 100644 --- a/src/dom/node.h +++ b/src/dom/node.h @@ -318,18 +318,34 @@ get_dom_node_map_entry(struct dom_node_list *node_map, /* Removes the node and all its children and free()s itself */ void done_dom_node(struct dom_node *node); +#ifndef DEBUG_MEMLEAK + /* The allocated argument is used as the value of node->allocated if >= 0. * Use -1 to default node->allocated to the value of parent->allocated. */ + struct dom_node * -init_dom_node_(unsigned char *file, int line, - struct dom_node *parent, enum dom_node_type type, - struct dom_string *string, int allocated); +init_dom_node_at(struct dom_node *parent, enum dom_node_type type, + struct dom_string *string, int allocated); #define init_dom_node(type, string, allocated) \ - init_dom_node_(__FILE__, __LINE__, NULL, type, string, allocated) + init_dom_node_at(NULL, type, string, allocated) #define add_dom_node(parent, type, string) \ - init_dom_node_(__FILE__, __LINE__, parent, type, string, -1) + init_dom_node_at(parent, type, string, -1) + +#else +struct dom_node * +init_dom_node_at(unsigned char *file, int line, + struct dom_node *parent, enum dom_node_type type, + struct dom_string *string, int allocated); + +#define init_dom_node(type, string, allocated) \ + init_dom_node_at(__FILE__, __LINE__, NULL, type, string, allocated) + +#define add_dom_node(parent, type, string) \ + init_dom_node_at(__FILE__, __LINE__, parent, type, string, -1) + +#endif /* DEBUG_MEMLEAK */ #define add_dom_element(parent, string) \ add_dom_node(parent, DOM_NODE_ELEMENT, string)