Skip to content

Commit 649c5ee

Browse files
committed
DomParser, SaxParser: Move anonymous namespace out of namespace xmlpp
1 parent 524861b commit 649c5ee

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

libxml++/parsers/domparser.cc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@
1717
#include <sstream>
1818
#include <iostream>
1919

20+
namespace {
21+
extern "C" {
22+
static int _io_read_callback(void * context,
23+
char * buffer,
24+
int len)
25+
{
26+
auto in = static_cast<std::istream*>(context);
27+
in->read(buffer, len);
28+
return in->gcount();
29+
}
30+
}
31+
}
32+
2033
namespace xmlpp
2134
{
2235

@@ -174,19 +187,6 @@ void DomParser::check_xinclude_and_finish_parsing()
174187
Parser::release_underlying();
175188
}
176189

177-
namespace {
178-
extern "C" {
179-
static int _io_read_callback(void * context,
180-
char * buffer,
181-
int len)
182-
{
183-
auto in = static_cast<std::istream*>(context);
184-
in->read(buffer, len);
185-
return in->gcount();
186-
}
187-
}
188-
}
189-
190190
void DomParser::parse_stream(std::istream& in)
191191
{
192192
release_underlying(); //Free any existing document.

libxml++/parsers/saxparser.cc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@
1717
#include <cstdarg> //For va_list.
1818
#include <iostream>
1919

20+
namespace {
21+
extern "C" {
22+
static int _io_read_callback(void * context,
23+
char * buffer,
24+
int len)
25+
{
26+
auto in = static_cast<std::istream*>(context);
27+
in->read(buffer, len);
28+
return in->gcount();
29+
}
30+
}
31+
}
32+
2033
namespace xmlpp {
2134

2235
struct SaxParserCallback
@@ -209,19 +222,6 @@ void SaxParser::parse_memory(const ustring& contents)
209222
parse_memory_raw((const unsigned char*)contents.c_str(), contents.size());
210223
}
211224

212-
namespace {
213-
extern "C" {
214-
static int _io_read_callback(void * context,
215-
char * buffer,
216-
int len)
217-
{
218-
auto in = static_cast<std::istream*>(context);
219-
in->read(buffer, len);
220-
return in->gcount();
221-
}
222-
}
223-
}
224-
225225
void SaxParser::parse_stream(std::istream& in)
226226
{
227227
if(context_)

tests/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
test_programs = [
77
# [[dir-name], exe-name, [sources]]
8+
[['istream_ioparser'], 'test', ['main.cc']],
89
[['saxparser_chunk_parsing_inconsistent_state'], 'test', ['main.cc']],
910
[['saxparser_parse_double_free'], 'test', ['main.cc']],
1011
[['saxparser_parse_stream_inconsistent_state'], 'test', ['main.cc']],
11-
[['istream_ioparser'], 'test', ['main.cc']],
1212
]
1313

1414
foreach ex : test_programs

0 commit comments

Comments
 (0)