summaryrefslogtreecommitdiffstats
path: root/src/document.cpp
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2014-01-26 17:19:47 +0000
committerMartin Owens <doctormo@gmail.com>2014-01-26 17:19:47 +0000
commit7455f1a259ce28ee56866b5cde06e79be4cfaf97 (patch)
tree5c10c6096fac9f5ff169abbc32133bc3b3dc1094 /src/document.cpp
parentA partial refactor of sp-image.cpp, expect more. (diff)
downloadinkscape-7455f1a259ce28ee56866b5cde06e79be4cfaf97.tar.gz
inkscape-7455f1a259ce28ee56866b5cde06e79be4cfaf97.zip
Check file existance and clean up memory issues thanks to KK and Johan
(bzr r12979)
Diffstat (limited to '')
-rw-r--r--src/document.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/document.cpp b/src/document.cpp
index e456f2b81..634462001 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -478,22 +478,22 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc,
/**
* Fetches a document and attaches it to the current document as a child href
*/
-SPDocument *SPDocument::createChildDoc(std::string const uri)
+SPDocument *SPDocument::createChildDoc(std::string const &uri)
{
SPDocument *parent = this;
SPDocument *document = NULL;
while(parent != NULL && document == NULL) {
// Check myself and any parents int he chain
- if(uri.compare(parent->getURI())==0) {
+ if(uri == parent->getURI()) {
document = parent;
break;
}
// Then check children of those.
boost::ptr_list<SPDocument>::iterator iter;
for (iter = parent->_child_documents.begin();
- iter != parent->_child_documents.end(); ++iter) {
- if(uri.compare(iter->getURI())==0) {
+ iter != parent->_child_documents.end(); ++iter) {
+ if(uri == iter->getURI()) {
document = &*iter;
break;
}
@@ -503,7 +503,7 @@ SPDocument *SPDocument::createChildDoc(std::string const uri)
// Load a fresh document from the svg source.
if(!document) {
- const char *path = g_strdup(uri.c_str());
+ const char *path = uri.c_str();
document = createNewDoc(path, false, false, this);
}
return document;