From: pjrm Date: Sun, 5 Apr 2009 22:36:39 +0000 (+0000) Subject: functional noop: extension/system.cpp: g_strdup handles NULL fine, so don't bother... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5e21eb68cae04d0fc9d349f3d1b7bccc2060e337;p=inkscape.git functional noop: extension/system.cpp: g_strdup handles NULL fine, so don't bother checking with an extra function call. --- diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 31cf877a8..edbe42dac 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -253,20 +253,15 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, gchar *saved_uri = NULL; if (!official) { saved_modified = doc->isModifiedSinceSave(); - if (repr->attribute("inkscape:output_extension")) { - saved_output_extension = g_strdup(repr->attribute("inkscape:output_extension")); - } - if (repr->attribute("inkscape:dataloss")) { - saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss")); - } - if (doc->uri) { - saved_uri = g_strdup(doc->uri); - } + saved_output_extension = g_strdup(repr->attribute("inkscape:output_extension")); + saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss")); + saved_uri = g_strdup(doc->uri); } // update attributes: bool saved = sp_document_get_undo_sensitive(doc); sp_document_set_undo_sensitive (doc, false); + { // save the filename for next use sp_document_set_uri(doc, fileName); // also save the extension for next use @@ -276,6 +271,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, if ( omod->causes_dataloss() ) { repr->setAttribute("inkscape:dataloss", "true"); } + } sp_document_set_undo_sensitive (doc, saved); doc->setModifiedSinceSave(false); @@ -285,17 +281,19 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, if ( !official) { saved = sp_document_get_undo_sensitive(doc); sp_document_set_undo_sensitive (doc, false); + { repr->setAttribute("inkscape:output_extension", saved_output_extension); repr->setAttribute("inkscape:dataloss", saved_dataloss); sp_document_set_uri(doc, saved_uri); + } sp_document_set_undo_sensitive (doc, saved); doc->setModifiedSinceSave(saved_modified); + + g_free(saved_output_extension); + g_free(saved_dataloss); + g_free(saved_uri); } - if (saved_output_extension) g_free(saved_output_extension); - if (saved_dataloss) g_free(saved_dataloss); - if (saved_uri) g_free(saved_uri); - g_free(fileName); return; }