Commit 860aa9d6 authored by Max Kellermann's avatar Max Kellermann

lib/expat/ExpatParser: move InputStream overload to separate source file

Eliminate one unnecessary dependency for debug programs which don't need the InputStream API.
parent 64dc5212
......@@ -1577,6 +1577,7 @@ endif
if ENABLE_EXPAT
libplaylist_plugins_a_SOURCES += \
src/lib/expat/StreamExpatParser.cxx \
src/lib/expat/ExpatParser.cxx src/lib/expat/ExpatParser.hxx \
src/playlist/plugins/XspfPlaylistPlugin.cxx \
src/playlist/plugins/XspfPlaylistPlugin.hxx \
......
......@@ -19,7 +19,6 @@
#include "config.h"
#include "ExpatParser.hxx"
#include "input/InputStream.hxx"
#include "util/ASCII.hxx"
#include <string.h>
......@@ -31,23 +30,6 @@ ExpatParser::Parse(const char *data, size_t length, bool is_final)
throw ExpatError(parser);
}
void
ExpatParser::Parse(InputStream &is)
{
assert(is.IsReady());
while (true) {
char buffer[4096];
size_t nbytes = is.LockRead(buffer, sizeof(buffer));
if (nbytes == 0)
break;
Parse(buffer, nbytes, false);
}
Parse("", 0, true);
}
const char *
ExpatParser::GetAttribute(const XML_Char **atts,
const char *name)
......
/*
* Copyright 2003-2017 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "ExpatParser.hxx"
#include "input/InputStream.hxx"
void
ExpatParser::Parse(InputStream &is)
{
assert(is.IsReady());
while (true) {
char buffer[4096];
size_t nbytes = is.LockRead(buffer, sizeof(buffer));
if (nbytes == 0)
break;
Parse(buffer, nbytes, false);
}
Parse("", 0, true);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment