From a7e1cc466ae291852dd1f0c296417250483b137c Mon Sep 17 00:00:00 2001 From: fluxgen Date: Wed, 9 Jan 2002 14:07:09 +0000 Subject: Updated copyright date and fixed auto_ptr --- src/fluxbox.cc | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 8f8e044..dbf09f1 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -1,5 +1,5 @@ -// fluxbox.cc for Fluxbox. -// Copyright (c) 2001 Henrik Kinnunen (fluxgen@linuxmail.org) +// fluxbox.cc for Fluxbox Window Manager +// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) // // blackbox.cc for blackbox - an X11 Window manager // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) @@ -22,6 +22,8 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. +// $Id: fluxbox.cc,v 1.16 2002/01/09 14:07:09 fluxgen Exp $ + // stupid macros needed to access some functions in version 2 of the GNU C // library #ifndef _GNU_SOURCE @@ -1427,7 +1429,7 @@ void Fluxbox::save_rc(void) { XrmDatabase new_blackboxrc = (XrmDatabase) 0; char rc_string[1024]; - char *dbfile = getRcFilename(); //note: dbfile memory will be release @ end of function + auto_ptr dbfile(getRcFilename()); // load_rc(); This overwrites configs made while running, for example // usage of iconbar and tabs @@ -1680,15 +1682,13 @@ void Fluxbox::save_rc(void) { delete [] save_string; } - XrmDatabase old_blackboxrc = XrmGetFileDatabase(dbfile); + XrmDatabase old_blackboxrc = XrmGetFileDatabase(dbfile.get()); XrmMergeDatabases(new_blackboxrc, &old_blackboxrc); //merge database together - XrmPutFileDatabase(old_blackboxrc, dbfile); + XrmPutFileDatabase(old_blackboxrc, dbfile.get()); XrmDestroyDatabase(old_blackboxrc); // XrmDestroyDatabase(new_blackboxrc); - - //finaly release filename memory - delete [] dbfile; + } //-------- getRcFilename ------------- @@ -1716,17 +1716,15 @@ void Fluxbox::load_rc(void) { XrmDatabase database = (XrmDatabase) 0; //get resource filename - char *dbfile = getRcFilename(); //note: dont forget to free memory + auto_ptr dbfile(getRcFilename()); //load file - database = XrmGetFileDatabase(dbfile); + database = XrmGetFileDatabase(dbfile.get()); if (!database) { - cerr<<"Fluxbox: Cant open "< dbfile(getRcFilename()); - database = XrmGetFileDatabase(dbfile); + database = XrmGetFileDatabase(dbfile.get()); if (!database) database = XrmGetFileDatabase(DEFAULT_INITFILE); - - delete [] dbfile; XrmValue value; char *value_type, name_lookup[1024], class_lookup[1024]; @@ -2398,21 +2394,19 @@ void Fluxbox::real_reconfigure(void) { XrmDatabase new_blackboxrc = (XrmDatabase) 0; char style[MAXPATHLEN + 64]; - char *dbfile = getRcFilename(); + auto_ptr dbfile(getRcFilename()); sprintf(style, "session.styleFile: %s", resource.style_file); XrmPutLineResource(&new_blackboxrc, style); - XrmDatabase old_blackboxrc = XrmGetFileDatabase(dbfile); + XrmDatabase old_blackboxrc = XrmGetFileDatabase(dbfile.get()); XrmMergeDatabases(new_blackboxrc, &old_blackboxrc); - XrmPutFileDatabase(old_blackboxrc, dbfile); + XrmPutFileDatabase(old_blackboxrc, dbfile.get()); if (old_blackboxrc) XrmDestroyDatabase(old_blackboxrc); - delete [] dbfile; - for (int i = 0, n = menuTimestamps->count(); i < n; i++) { MenuTimestamp *ts = menuTimestamps->remove(0); -- cgit v0.11.2