Skip to content

Commit afc6e94

Browse files
committed
dev: remove the DEBUG macro
I haven't used it in years, TBH, and what it does is completely insufficient to debug memory issues in modern Ruby anyway.
1 parent 2443f8e commit afc6e94

15 files changed

+2
-60
lines changed

ext/nokogiri/html4_sax_parser_context.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@ VALUE cNokogiriHtml4SaxParserContext ;
55
static void
66
deallocate(xmlParserCtxtPtr ctxt)
77
{
8-
NOKOGIRI_DEBUG_START(ctxt);
9-
108
ctxt->sax = NULL;
11-
129
htmlFreeParserCtxt(ctxt);
13-
14-
NOKOGIRI_DEBUG_END(ctxt);
1510
}
1611

1712
static VALUE

ext/nokogiri/nokogiri.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,6 @@ xmlNodePtr xmlLastElementChild(xmlNodePtr parent);
7575
#define NOKOGIRI_STR_NEW(str, len) rb_external_str_new_with_enc((const char *)(str), (long)(len), rb_utf8_encoding())
7676
#define RBSTR_OR_QNIL(_str) (_str ? NOKOGIRI_STR_NEW2(_str) : Qnil)
7777

78-
#ifdef DEBUG
79-
# define NOKOGIRI_DEBUG_START(p) if (getenv("NOKOGIRI_NO_FREE")) return ; if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p start\n", __FILE__, __LINE__, p);
80-
# define NOKOGIRI_DEBUG_END(p) if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p end\n", __FILE__, __LINE__, p);
81-
#else
82-
# define NOKOGIRI_DEBUG_START(p)
83-
# define NOKOGIRI_DEBUG_END(p)
84-
#endif
85-
8678
#ifndef NORETURN_DECL
8779
# if defined(__GNUC__)
8880
# define NORETURN_DECL __attribute__ ((noreturn))

ext/nokogiri/xml_document.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ dealloc(xmlDocPtr doc)
6565
{
6666
st_table *node_hash;
6767

68-
NOKOGIRI_DEBUG_START(doc);
69-
7068
node_hash = DOC_UNLINKED_NODE_HASH(doc);
7169

7270
st_foreach(node_hash, dealloc_node_i, (st_data_t)doc);
@@ -84,8 +82,6 @@ dealloc(xmlDocPtr doc)
8482
}
8583

8684
xmlFreeDoc(doc);
87-
88-
NOKOGIRI_DEBUG_END(doc);
8985
}
9086

9187
static void

ext/nokogiri/xml_namespace.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ dealloc_namespace(xmlNsPtr ns)
3131
* this deallocator is only used for namespace nodes that are part of an xpath
3232
* node set. see noko_xml_namespace_wrap().
3333
*/
34-
NOKOGIRI_DEBUG_START(ns) ;
3534
if (ns->href) {
3635
xmlFree(DISCARD_CONST_QUAL_XMLCHAR(ns->href));
3736
}
3837
if (ns->prefix) {
3938
xmlFree(DISCARD_CONST_QUAL_XMLCHAR(ns->prefix));
4039
}
4140
xmlFree(ns);
42-
NOKOGIRI_DEBUG_END(ns) ;
4341
}
4442

4543

ext/nokogiri/xml_node.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,7 @@ static ID id_decorate, id_decorate_bang;
99

1010
typedef xmlNodePtr(*pivot_reparentee_func)(xmlNodePtr, xmlNodePtr);
1111

12-
#ifdef DEBUG
13-
static void
14-
_xml_node_dealloc(xmlNodePtr x)
15-
{
16-
NOKOGIRI_DEBUG_START(x)
17-
NOKOGIRI_DEBUG_END(x)
18-
}
19-
#else
20-
# define _xml_node_dealloc 0
21-
#endif
12+
#define _xml_node_dealloc 0
2213

2314
static void
2415
_xml_node_mark(xmlNodePtr node)

ext/nokogiri/xml_node_set.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,11 @@ deallocate(xmlNodeSetPtr node_set)
8888
* For reasons outlined in xml_namespace.c, here we reproduce xmlXPathFreeNodeSet() except for the
8989
* offending call to xmlXPathNodeSetFreeNs().
9090
*/
91-
NOKOGIRI_DEBUG_START(node_set) ;
9291
if (node_set->nodeTab != NULL) {
9392
xmlFree(node_set->nodeTab);
9493
}
9594

9695
xmlFree(node_set);
97-
NOKOGIRI_DEBUG_END(node_set) ;
9896
}
9997

10098

ext/nokogiri/xml_reader.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ VALUE cNokogiriXmlReader;
55
static void
66
dealloc(xmlTextReaderPtr reader)
77
{
8-
NOKOGIRI_DEBUG_START(reader);
98
xmlFreeTextReader(reader);
10-
NOKOGIRI_DEBUG_END(reader);
119
}
1210

1311
static int

ext/nokogiri/xml_relax_ng.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ VALUE cNokogiriXmlRelaxNG;
55
static void
66
dealloc(xmlRelaxNGPtr schema)
77
{
8-
NOKOGIRI_DEBUG_START(schema);
98
xmlRelaxNGFree(schema);
10-
NOKOGIRI_DEBUG_END(schema);
119
}
1210

1311
/*

ext/nokogiri/xml_sax_parser.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,7 @@ processing_instruction(void *ctx, const xmlChar *name, const xmlChar *content)
268268
static void
269269
deallocate(xmlSAXHandlerPtr handler)
270270
{
271-
NOKOGIRI_DEBUG_START(handler);
272271
ruby_xfree(handler);
273-
NOKOGIRI_DEBUG_END(handler);
274272
}
275273

276274
static VALUE

ext/nokogiri/xml_sax_parser_context.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@ static ID id_read;
77
static void
88
deallocate(xmlParserCtxtPtr ctxt)
99
{
10-
NOKOGIRI_DEBUG_START(ctxt);
11-
1210
ctxt->sax = NULL;
13-
1411
xmlFreeParserCtxt(ctxt);
15-
16-
NOKOGIRI_DEBUG_END(ctxt);
1712
}
1813

1914
/*

0 commit comments

Comments
 (0)