From 7455f1a259ce28ee56866b5cde06e79be4cfaf97 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Sun, 26 Jan 2014 12:19:47 -0500 Subject: Check file existance and clean up memory issues thanks to KK and Johan (bzr r12979) --- src/document.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/document.cpp') 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::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; -- cgit v1.2.3