@@ -14,46 +14,17 @@ def test_patch(file, directory, input, expected)
14
14
end
15
15
16
16
original = <<-EOF
17
- static void warning_func(void * ctx, const char *msg, ... )
17
+ static int dealloc_node_i(xmlNodePtr key, xmlNodePtr node, xmlDocPtr doc )
18
18
{
19
- VALUE self = NOKOGIRI_SAX_SELF(ctx);
20
- VALUE doc = rb_iv_get(self, "@document");
21
- char * message;
22
- VALUE ruby_message;
23
-
24
- va_list args;
25
- va_start(args, msg);
26
- vasprintf(&message, msg, args);
27
- va_end(args);
28
-
29
- ruby_message = NOKOGIRI_STR_NEW2(message);
30
- vasprintf_free(message);
31
- rb_funcall(doc, id_warning, 1, ruby_message);
32
19
}
33
20
EOF
34
21
35
22
modified = <<-EOF
36
- static void warning_func(void * ctx, const char *msg, ... )
23
+ static int dealloc_node_i(st_data_t a, st_data_t b, st_data_t c, int errorState )
37
24
{
38
- VALUE self = NOKOGIRI_SAX_SELF(ctx);
39
- VALUE doc = rb_iv_get(self, "@document");
40
- char * message;
41
- VALUE ruby_message;
42
-
43
- #ifdef NOKOGIRI_PACKAGED_LIBRARIES
44
- va_list args;
45
- va_start(args, msg);
46
- vasprintf(&message, msg, args);
47
- va_end(args);
48
-
49
- ruby_message = NOKOGIRI_STR_NEW2(message);
50
- vasprintf_free(message);
51
- rb_funcall(doc, id_warning, 1, ruby_message);
52
- #else
53
- rb_funcall(doc, id_warning, 1, NOKOGIRI_STR_NEW2("Warning."));
54
- #endif
55
-
56
- }
25
+ xmlNodePtr key = (xmlNodePtr)a;
26
+ xmlNodePtr node = (xmlNodePtr)b;
27
+ xmlDocPtr doc = (xmlDocPtr)c;}
57
28
EOF
58
29
59
30
json_original = <<-EOF
@@ -68,7 +39,7 @@ def test_patch(file, directory, input, expected)
68
39
# endif
69
40
EOF
70
41
71
- test_patch 'xml_sax_parser .c' , 'ext/nokogiri' , original , modified
42
+ test_patch 'xml_document .c' , 'ext/nokogiri' , original , modified
72
43
# Should not patch other files or other gems
73
44
test_patch 'other_file.c' , 'ext/nokogiri' , original , original
74
45
test_patch 'xml_sax_parser.c' , 'ext/other_gem' , original , original
0 commit comments