Enlightenment CVS committal
Author : tsauerbeck
Project : misc
Module : embrace
Dir : misc/embrace/src
Modified Files:
embrace.c
Log Message:
fixed memleaks caused by not freeing the result of e_db_str_get(). finally embrace
will tell you when a mailbox cannot be loaded due to configuration errors.
===================================================================
RCS file: /cvsroot/enlightenment/misc/embrace/src/embrace.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- embrace.c 9 Apr 2004 17:33:06 -0000 1.7
+++ embrace.c 17 Apr 2004 15:05:49 -0000 1.8
@@ -1,5 +1,5 @@
/*
- * $Id: embrace.c,v 1.7 2004/04/09 17:33:06 tsauerbeck Exp $
+ * $Id: embrace.c,v 1.8 2004/04/17 15:05:49 tsauerbeck Exp $
*
* Copyright (C) 2004 Embrace project.
*
@@ -158,7 +158,8 @@
static MailBox *load_mailbox (Embrace *e, E_DB_File *edb, int i)
{
- MailBox *mailbox;
+ MailBox *mb;
+ EmbracePlugin *p;
char key[32], *str;
int val;
@@ -167,46 +168,57 @@
/* read title */
snprintf (key, sizeof (key), "/" PACKAGE "/mailbox%i/title", i);
- if (!(str = e_db_str_get (edb, key)))
+ if (!(str = e_db_str_get (edb, key))) {
+ fprintf (stderr, "mailbox %i: 'title' not specified!\n", i);
return NULL;
+ }
- if (!(mailbox = mailbox_new (e->gui.evas, e->cfg.theme)))
+ if (!(mb = mailbox_new (e->gui.evas, e->cfg.theme)))
return NULL;
- mailbox_title_set (mailbox, str);
+ mailbox_title_set (mb, str);
free (str);
/* read poll interval */
snprintf (key, sizeof (key), "/" PACKAGE "/mailbox%i/interval", i);
if (e_db_int_get (edb, key, &val))
- mailbox_poll_interval_set (mailbox, val);
+ mailbox_poll_interval_set (mb, val);
/* read mailbox type */
snprintf (key, sizeof (key), "/" PACKAGE "/mailbox%i/type", i);
if (!(str = e_db_str_get (edb, key))) {
- mailbox_free (mailbox);
+ fprintf (stderr, "mailbox %i: 'type' not specified!\n", i);
+ mailbox_free (mb);
return NULL;
}
- mailbox_plugin_set (mailbox, find_plugin (e, str));
- free (str);
-
- if (!mailbox_plugin_get (mailbox)) {
- mailbox_free (mailbox);
+ /* try to find the plugin for this mailbox type */
+ if (!(p = find_plugin (e, str))) {
+ fprintf (stderr,
+ "mailbox %i: no plugin found for type '%s'!\n",
+ i, str);
+ free (str);
+ mailbox_free (mb);
return NULL;
}
+ mailbox_plugin_set (mb, p);
+ free (str);
+
/* load plugin-specific config */
snprintf (key, sizeof (key), "/" PACKAGE "/mailbox%i", i);
- if (!mailbox_load_config (mailbox, edb, key)) {
- mailbox_free (mailbox);
+ if (!mailbox_load_config (mb, edb, key)) {
+ fprintf (stderr,
+ "mailbox %i: "
+ "loading plugin-specific configuration failed!\n", i);
+ mailbox_free (mb);
return NULL;
}
- return mailbox;
+ return mb;
}
static int load_mailboxes (Embrace *e, E_DB_File *edb)
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs