[evolution-patches] 40252, addressbook, calendar conduit compile portability
- From: Not Zed <notzed ximian com>
- To: evolution-patches ximian com
- Subject: [evolution-patches] 40252, addressbook, calendar conduit compile portability
- Date: 03 Apr 2003 12:16:13 +0930
These conduits use non-portable gcc extensions for varadic macro's for
some logging functions.
The patch from sun is incorrect since it changes the behaviour (it drops
all the varags), and it also uses c99 syntax.
To do it properly we'd have to check for support for various differnet
types of varargs macro support (glib macro's provide this), and also
provide fallback functions ... and not be able to compile them out
anyway.
This patch changes the WARN/INFO #defines to g_warning, etc. I think
that'll work, otherwise the calls to WARN/INFO should just call the
direct interfaces.
It also changes the LOG() calls to call LOG(g_message()) so that the
calls can be compiled in/out at will.
I haven't tested the build of these, as i dont have the libraries
installed to build the conduits.
Z
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.1703
diff -u -3 -r1.1703 ChangeLog
--- calendar/ChangeLog 2 Apr 2003 19:30:29 -0000 1.1703
+++ calendar/ChangeLog 3 Apr 2003 02:41:42 -0000
@@ -1,3 +1,14 @@
+2003-04-03 Not Zed <NotZed Ximian com>
+
+ ** See bug #40252
+
+ * conduits/todo/todo-conduit.c: Same as below.
+
+ * conduits/calendar/calendar-conduit.c: Change the LOG macro to a
+ single arg macro which copies its arg. Fix all callers. Change
+ WARN and INFO to simply g_warning/g_message. Init G_LOG_DOMAIN
+ before including anything.
+
2003-04-02 Jeffrey Stedfast <fejj ximian com>
* gui/control-factory.c (set_prop): Add a check to see if the view
Index: calendar/conduits/calendar/calendar-conduit.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/calendar/calendar-conduit.c,v
retrieving revision 1.111
diff -u -3 -r1.111 calendar-conduit.c
--- calendar/conduits/calendar/calendar-conduit.c 1 Apr 2003 16:48:57 -0000 1.111
+++ calendar/conduits/calendar/calendar-conduit.c 3 Apr 2003 02:41:42 -0000
@@ -23,6 +23,8 @@
#include <config.h>
+#define G_LOG_DOMAIN "ecalconduit"
+
#include <cal-client/cal-client-types.h>
#include <cal-client/cal-client.h>
#include <cal-util/timeutil.h>
@@ -43,22 +45,18 @@
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
#define CONDUIT_VERSION "0.1.6"
-#ifdef G_LOG_DOMAIN
-#undef G_LOG_DOMAIN
-#endif
-#define G_LOG_DOMAIN "ecalconduit"
#define DEBUG_CALCONDUIT 1
/* #undef DEBUG_CALCONDUIT */
#ifdef DEBUG_CALCONDUIT
-#define LOG(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e)
+#define LOG(x) x
#else
-#define LOG(e...)
+#define LOG(x)
#endif
-#define WARN(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, e)
-#define INFO(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e)
+#define WARN g_warning
+#define INFO g_message
#define PILOT_MAX_ADVANCE 99
@@ -1305,7 +1303,7 @@
/* Or if the URI's don't match */
uri = cal_client_get_uri (ctxt->client);
- LOG(" Current URI %s (%s)\n", uri, ctxt->cfg->last_uri ? ctxt->cfg->last_uri : "<NONE>");
+ LOG (g_message ( " Current URI %s (%s)\n", uri, ctxt->cfg->last_uri ? ctxt->cfg->last_uri : "<NONE>" ));
if (ctxt->cfg->last_uri != NULL && strcmp (ctxt->cfg->last_uri, uri)) {
gnome_pilot_conduit_standard_set_slow (conduit, TRUE);
e_pilot_map_clear (ctxt->map);
@@ -1313,9 +1311,9 @@
if (gnome_pilot_conduit_standard_get_slow (conduit)) {
ctxt->map->write_touched_only = TRUE;
- LOG (" doing slow sync\n");
+ LOG (g_message ( " doing slow sync\n" ));
} else {
- LOG (" doing fast sync\n");
+ LOG (g_message ( " doing fast sync\n" ));
}
}
@@ -1334,8 +1332,8 @@
abs_conduit = GNOME_PILOT_CONDUIT_SYNC_ABS (conduit);
- LOG ("---------------------------------------------------------\n");
- LOG ("pre_sync: Calendar Conduit v.%s", CONDUIT_VERSION);
+ LOG (g_message ( "---------------------------------------------------------\n" ));
+ LOG (g_message ( "pre_sync: Calendar Conduit v.%s", CONDUIT_VERSION ));
ctxt->dbi = dbi;
ctxt->client = NULL;
@@ -1350,7 +1348,7 @@
ctxt->timezone = get_default_timezone ();
if (ctxt->timezone == NULL)
return -1;
- LOG (" Using timezone: %s", icaltimezone_get_tzid (ctxt->timezone));
+ LOG (g_message ( " Using timezone: %s", icaltimezone_get_tzid (ctxt->timezone) ));
/* Set the default timezone on the backend. */
if (ctxt->timezone)
@@ -1464,7 +1462,7 @@
GList *changed;
gchar *filename, *change_id;
- LOG ("post_sync: Calendar Conduit v.%s", CONDUIT_VERSION);
+ LOG (g_message ( "post_sync: Calendar Conduit v.%s", CONDUIT_VERSION ));
g_free (ctxt->cfg->last_uri);
ctxt->cfg->last_uri = g_strdup (cal_client_get_uri (ctxt->client));
@@ -1482,7 +1480,7 @@
cal_client_change_list_free (changed);
g_free (change_id);
- LOG ("---------------------------------------------------------\n");
+ LOG (g_message ( "---------------------------------------------------------\n" ));
return 0;
}
@@ -1495,7 +1493,7 @@
{
const char *uid;
- LOG ("set_pilot_id: setting to %d\n", ID);
+ LOG (g_message ( "set_pilot_id: setting to %d\n", ID ));
cal_component_get_uid (local->comp, &uid);
e_pilot_map_insert (ctxt->map, ID, uid, FALSE);
@@ -1510,7 +1508,7 @@
{
const char *uid;
- LOG ("set_status_cleared: clearing status\n");
+ LOG (g_message ( "set_status_cleared: clearing status\n" ));
cal_component_get_uid (local->comp, &uid);
g_hash_table_remove (ctxt->changed_hash, uid);
@@ -1529,13 +1527,13 @@
g_return_val_if_fail (local != NULL, -1);
if (*local == NULL) {
- LOG ("beginning for_each");
+ LOG (g_message ( "beginning for_each" ));
uids = ctxt->uids;
count = 0;
if (uids != NULL) {
- LOG ("iterating over %d records", g_list_length (uids));
+ LOG (g_message ( "iterating over %d records", g_list_length (uids) ));
*local = g_new0 (ECalLocalRecord, 1);
local_record_from_uid (*local, uids->data, ctxt);
@@ -1543,7 +1541,7 @@
iterator = uids;
} else {
- LOG ("no events");
+ LOG (g_message ( "no events" ));
(*local) = NULL;
return 0;
}
@@ -1556,7 +1554,7 @@
local_record_from_uid (*local, iterator->data, ctxt);
g_list_prepend (ctxt->locals, *local);
} else {
- LOG ("for_each ending");
+ LOG (g_message ( "for_each ending" ));
/* Tell the pilot the iteration is over */
*local = NULL;
@@ -1579,13 +1577,13 @@
g_return_val_if_fail (local != NULL, -1);
if (*local == NULL) {
- LOG ("for_each_modified beginning\n");
+ LOG (g_message ( "for_each_modified beginning\n" ));
iterator = ctxt->changed;
count = 0;
- LOG ("iterating over %d records", g_hash_table_size (ctxt->changed_hash));
+ LOG (g_message ( "iterating over %d records", g_hash_table_size (ctxt->changed_hash) ));
iterator = next_changed_item (ctxt, iterator);
if (iterator != NULL) {
@@ -1595,7 +1593,7 @@
local_record_from_comp (*local, ccc->comp, ctxt);
g_list_prepend (ctxt->locals, *local);
} else {
- LOG ("no events");
+ LOG (g_message ( "no events" ));
*local = NULL;
}
@@ -1609,7 +1607,7 @@
local_record_from_comp (*local, ccc->comp, ctxt);
g_list_prepend (ctxt->locals, *local);
} else {
- LOG ("for_each_modified ending");
+ LOG (g_message ( "for_each_modified ending" ));
/* Signal the iteration is over */
*local = NULL;
@@ -1642,9 +1640,9 @@
retval = 1;
if (retval == 0)
- LOG (" equal");
+ LOG (g_message ( " equal" ));
else
- LOG (" not equal");
+ LOG (g_message ( " not equal" ));
return retval;
}
@@ -1660,7 +1658,7 @@
g_return_val_if_fail (remote != NULL, -1);
- LOG ("add_record: adding %s to desktop\n", print_remote (remote));
+ LOG (g_message ( "add_record: adding %s to desktop\n", print_remote (remote) ));
comp = comp_from_remote_record (conduit, remote, ctxt->default_comp, ctxt->client, ctxt->timezone);
@@ -1712,7 +1710,7 @@
cal_component_get_uid (local->comp, &uid);
- LOG ("delete_record: deleting %s\n", uid);
+ LOG (g_message ( "delete_record: deleting %s\n", uid ));
e_pilot_map_remove_by_uid (ctxt->map, uid);
cal_client_remove_object (ctxt->client, uid);
@@ -1731,7 +1729,7 @@
g_return_val_if_fail (local != NULL, -1);
- LOG ("archive_record: %s\n", archive ? "yes" : "no");
+ LOG (g_message ( "archive_record: %s\n", archive ? "yes" : "no" ));
cal_component_get_uid (local->comp, &uid);
e_pilot_map_insert (ctxt->map, local->local.ID, uid, archive);
@@ -1759,7 +1757,7 @@
if (!uid)
return 0;
- LOG (" matched\n");
+ LOG (g_message ( " matched\n" ));
*local = g_new0 (ECalLocalRecord, 1);
local_record_from_uid (*local, uid, ctxt);
@@ -1772,7 +1770,7 @@
ECalLocalRecord *local,
ECalConduitContext *ctxt)
{
- LOG ("free_match: freeing\n");
+ LOG (g_message ( "free_match: freeing\n" ));
g_return_val_if_fail (local != NULL, -1);
@@ -1787,7 +1785,7 @@
GnomePilotRecord *remote,
ECalConduitContext *ctxt)
{
- LOG ("prepare: encoding local %s\n", print_local (local));
+ LOG (g_message ( "prepare: encoding local %s\n", print_local (local) ));
*remote = local_record_to_pilot_record (local, ctxt);
@@ -1809,7 +1807,7 @@
GtkWidget *parent,
ECalConduitContext *ctxt)
{
- LOG ("create_settings_window");
+ LOG (g_message ( "create_settings_window" ));
ctxt->ps = e_pilot_settings_new ();
ctxt->gui = e_cal_gui_new (E_PILOT_SETTINGS (ctxt->ps));
@@ -1824,7 +1822,7 @@
static void
display_settings (GnomePilotConduit *conduit, ECalConduitContext *ctxt)
{
- LOG ("display_settings");
+ LOG (g_message ( "display_settings" ));
fill_widgets (ctxt);
}
@@ -1832,7 +1830,7 @@
static void
save_settings (GnomePilotConduit *conduit, ECalConduitContext *ctxt)
{
- LOG ("save_settings");
+ LOG (g_message ( "save_settings" ));
ctxt->new_cfg->secret =
e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps));
@@ -1844,7 +1842,7 @@
static void
revert_settings (GnomePilotConduit *conduit, ECalConduitContext *ctxt)
{
- LOG ("revert_settings");
+ LOG (g_message ( "revert_settings" ));
calconduit_save_configuration (ctxt->cfg);
calconduit_destroy_configuration (ctxt->new_cfg);
@@ -1857,7 +1855,7 @@
GtkObject *retval;
ECalConduitContext *ctxt;
- LOG ("in calendar's conduit_get_gpilot_conduit\n");
+ LOG (g_message ( "in calendar's conduit_get_gpilot_conduit\n" ));
retval = gnome_pilot_conduit_sync_abs_new ("DatebookDB", 0x64617465);
g_assert (retval != NULL);
Index: calendar/conduits/todo/todo-conduit.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/todo/todo-conduit.c,v
retrieving revision 1.81
diff -u -3 -r1.81 todo-conduit.c
--- calendar/conduits/todo/todo-conduit.c 1 Apr 2003 16:48:58 -0000 1.81
+++ calendar/conduits/todo/todo-conduit.c 3 Apr 2003 02:41:43 -0000
@@ -23,6 +23,8 @@
#include <config.h>
+#define G_LOG_DOMAIN "etodoconduit"
+
#include <cal-client/cal-client-types.h>
#include <cal-client/cal-client.h>
#include <cal-util/timeutil.h>
@@ -44,10 +46,6 @@
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
#define CONDUIT_VERSION "0.1.4"
-#ifdef G_LOG_DOMAIN
-#undef G_LOG_DOMAIN
-#endif
-#define G_LOG_DOMAIN "etodoconduit"
#define DEBUG_TODOCONDUIT 1
/* #undef DEBUG_TODOCONDUIT */
@@ -58,8 +56,8 @@
#define LOG(e...)
#endif
-#define WARN(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, e)
-#define INFO(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e)
+#define WARN g_warning
+#define INFO g_message
typedef struct _EToDoLocalRecord EToDoLocalRecord;
typedef struct _EToDoConduitCfg EToDoConduitCfg;
@@ -549,7 +547,7 @@
g_assert (local->comp != NULL);
g_assert (local->todo != NULL );
- LOG ("local_record_to_pilot_record\n");
+ LOG (g_message ( "local_record_to_pilot_record\n" ));
p.ID = local->local.ID;
p.category = local->local.category;
@@ -580,7 +578,7 @@
CalComponentClassification classif;
icaltimezone *default_tz = get_default_timezone ();
- LOG ("local_record_from_comp\n");
+ LOG (g_message ( "local_record_from_comp\n" ));
g_return_if_fail (local != NULL);
g_return_if_fail (comp != NULL);
@@ -846,7 +844,7 @@
/* Or if the URI's don't match */
uri = cal_client_get_uri (ctxt->client);
- LOG(" Current URI %s (%s)\n", uri, ctxt->cfg->last_uri ? ctxt->cfg->last_uri : "<NONE>");
+ LOG (g_message ( " Current URI %s (%s)\n", uri, ctxt->cfg->last_uri ? ctxt->cfg->last_uri : "<NONE>" ));
if (ctxt->cfg->last_uri != NULL && strcmp (ctxt->cfg->last_uri, uri)) {
gnome_pilot_conduit_standard_set_slow (conduit, TRUE);
e_pilot_map_clear (ctxt->map);
@@ -854,9 +852,9 @@
if (gnome_pilot_conduit_standard_get_slow (conduit)) {
ctxt->map->write_touched_only = TRUE;
- LOG (" doing slow sync\n");
+ LOG (g_message ( " doing slow sync\n" ));
} else {
- LOG (" doing fast sync\n");
+ LOG (g_message ( " doing fast sync\n" ));
}
}
@@ -875,8 +873,8 @@
abs_conduit = GNOME_PILOT_CONDUIT_SYNC_ABS (conduit);
- LOG ("---------------------------------------------------------\n");
- LOG ("pre_sync: ToDo Conduit v.%s", CONDUIT_VERSION);
+ LOG (g_message ( "---------------------------------------------------------\n" ));
+ LOG (g_message ( "pre_sync: ToDo Conduit v.%s", CONDUIT_VERSION ));
g_message ("ToDo Conduit v.%s", CONDUIT_VERSION);
ctxt->dbi = dbi;
@@ -892,7 +890,7 @@
ctxt->timezone = get_default_timezone ();
if (ctxt->timezone == NULL)
return -1;
- LOG (" Using timezone: %s", icaltimezone_get_tzid (ctxt->timezone));
+ LOG (g_message ( " Using timezone: %s", icaltimezone_get_tzid (ctxt->timezone) ));
/* Set the default timezone on the backend. */
if (ctxt->timezone)
@@ -978,7 +976,7 @@
GList *changed;
gchar *filename, *change_id;
- LOG ("post_sync: ToDo Conduit v.%s", CONDUIT_VERSION);
+ LOG (g_message ( "post_sync: ToDo Conduit v.%s", CONDUIT_VERSION ));
g_free (ctxt->cfg->last_uri);
ctxt->cfg->last_uri = g_strdup (cal_client_get_uri (ctxt->client));
@@ -996,7 +994,7 @@
cal_client_change_list_free (changed);
g_free (change_id);
- LOG ("---------------------------------------------------------\n");
+ LOG (g_message ( "---------------------------------------------------------\n" ));
return 0;
}
@@ -1009,7 +1007,7 @@
{
const char *uid;
- LOG ("set_pilot_id: setting to %d\n", ID);
+ LOG (g_message ( "set_pilot_id: setting to %d\n", ID ));
cal_component_get_uid (local->comp, &uid);
e_pilot_map_insert (ctxt->map, ID, uid, FALSE);
@@ -1024,7 +1022,7 @@
{
const char *uid;
- LOG ("set_status_cleared: clearing status\n");
+ LOG (g_message ( "set_status_cleared: clearing status\n" ));
cal_component_get_uid (local->comp, &uid);
g_hash_table_remove (ctxt->changed_hash, uid);
@@ -1043,13 +1041,13 @@
g_return_val_if_fail (local != NULL, -1);
if (*local == NULL) {
- LOG ("beginning for_each");
+ LOG (g_message ( "beginning for_each" ));
uids = ctxt->uids;
count = 0;
if (uids != NULL) {
- LOG ("iterating over %d records", g_list_length (uids));
+ LOG (g_message ( "iterating over %d records", g_list_length (uids) ));
*local = g_new0 (EToDoLocalRecord, 1);
local_record_from_uid (*local, uids->data, ctxt);
@@ -1057,7 +1055,7 @@
iterator = uids;
} else {
- LOG ("no events");
+ LOG (g_message ( "no events" ));
(*local) = NULL;
return 0;
}
@@ -1070,7 +1068,7 @@
local_record_from_uid (*local, iterator->data, ctxt);
g_list_prepend (ctxt->locals, *local);
} else {
- LOG ("for_each ending");
+ LOG (g_message ( "for_each ending" ));
/* Tell the pilot the iteration is over */
*local = NULL;
@@ -1093,13 +1091,13 @@
g_return_val_if_fail (local != NULL, 0);
if (*local == NULL) {
- LOG ("for_each_modified beginning\n");
+ LOG (g_message ( "for_each_modified beginning\n" ));
iterator = ctxt->changed;
count = 0;
- LOG ("iterating over %d records", g_hash_table_size (ctxt->changed_hash));
+ LOG (g_message ( "iterating over %d records", g_hash_table_size (ctxt->changed_hash) ));
iterator = next_changed_item (ctxt, iterator);
if (iterator != NULL) {
@@ -1109,7 +1107,7 @@
local_record_from_comp (*local, ccc->comp, ctxt);
g_list_prepend (ctxt->locals, *local);
} else {
- LOG ("no events");
+ LOG (g_message ( "no events" ));
*local = NULL;
}
@@ -1123,7 +1121,7 @@
local_record_from_comp (*local, ccc->comp, ctxt);
g_list_prepend (ctxt->locals, *local);
} else {
- LOG ("for_each_modified ending");
+ LOG (g_message ( "for_each_modified ending" ));
/* Signal the iteration is over */
*local = NULL;
@@ -1156,9 +1154,9 @@
retval = 1;
if (retval == 0)
- LOG (" equal");
+ LOG (g_message ( " equal" ));
else
- LOG (" not equal");
+ LOG (g_message ( " not equal" ));
return retval;
}
@@ -1174,7 +1172,7 @@
g_return_val_if_fail (remote != NULL, -1);
- LOG ("add_record: adding %s to desktop\n", print_remote (remote));
+ LOG (g_message ( "add_record: adding %s to desktop\n", print_remote (remote) ));
comp = comp_from_remote_record (conduit, remote, ctxt->default_comp, ctxt->timezone);
@@ -1224,7 +1222,7 @@
cal_component_get_uid (local->comp, &uid);
- LOG ("delete_record: deleting %s\n", uid);
+ LOG (g_message ( "delete_record: deleting %s\n", uid ));
e_pilot_map_remove_by_uid (ctxt->map, uid);
cal_client_remove_object (ctxt->client, uid);
@@ -1243,7 +1241,7 @@
g_return_val_if_fail (local != NULL, -1);
- LOG ("archive_record: %s\n", archive ? "yes" : "no");
+ LOG (g_message ( "archive_record: %s\n", archive ? "yes" : "no" ));
cal_component_get_uid (local->comp, &uid);
e_pilot_map_insert (ctxt->map, local->local.ID, uid, archive);
@@ -1271,7 +1269,7 @@
if (!uid)
return 0;
- LOG (" matched\n");
+ LOG (g_message ( " matched\n" ));
*local = g_new0 (EToDoLocalRecord, 1);
local_record_from_uid (*local, uid, ctxt);
@@ -1284,7 +1282,7 @@
EToDoLocalRecord *local,
EToDoConduitContext *ctxt)
{
- LOG ("free_match: freeing\n");
+ LOG (g_message ( "free_match: freeing\n" ));
g_return_val_if_fail (local != NULL, -1);
@@ -1299,7 +1297,7 @@
GnomePilotRecord *remote,
EToDoConduitContext *ctxt)
{
- LOG ("prepare: encoding local %s\n", print_local (local));
+ LOG (g_message ( "prepare: encoding local %s\n", print_local (local) ));
*remote = local_record_to_pilot_record (local, ctxt);
@@ -1321,7 +1319,7 @@
GtkWidget *parent,
EToDoConduitContext *ctxt)
{
- LOG ("create_settings_window");
+ LOG (g_message ( "create_settings_window" ));
ctxt->ps = e_pilot_settings_new ();
ctxt->gui = e_todo_gui_new (E_PILOT_SETTINGS (ctxt->ps));
@@ -1336,7 +1334,7 @@
static void
display_settings (GnomePilotConduit *conduit, EToDoConduitContext *ctxt)
{
- LOG ("display_settings");
+ LOG (g_message ( "display_settings" ));
fill_widgets (ctxt);
}
@@ -1344,7 +1342,7 @@
static void
save_settings (GnomePilotConduit *conduit, EToDoConduitContext *ctxt)
{
- LOG ("save_settings");
+ LOG (g_message ( "save_settings" ));
ctxt->new_cfg->secret = e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps));
e_todo_gui_fill_config (ctxt->gui, ctxt->new_cfg);
@@ -1355,7 +1353,7 @@
static void
revert_settings (GnomePilotConduit *conduit, EToDoConduitContext *ctxt)
{
- LOG ("revert_settings");
+ LOG (g_message ( "revert_settings" ));
todoconduit_save_configuration (ctxt->cfg);
todoconduit_destroy_configuration (ctxt->new_cfg);
@@ -1368,7 +1366,7 @@
GtkObject *retval;
EToDoConduitContext *ctxt;
- LOG ("in todo's conduit_get_gpilot_conduit\n");
+ LOG (g_message ( "in todo's conduit_get_gpilot_conduit\n" ));
retval = gnome_pilot_conduit_sync_abs_new ("ToDoDB", 0x746F646F);
g_assert (retval != NULL);
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1364
diff -u -3 -r1.1364 ChangeLog
--- addressbook/ChangeLog 2 Apr 2003 16:34:31 -0000 1.1364
+++ addressbook/ChangeLog 3 Apr 2003 02:41:54 -0000
@@ -1,3 +1,12 @@
+2003-04-03 Not Zed <NotZed Ximian com>
+
+ ** See bug #40252.
+
+ * conduit/address-conduit.c: Change the LOG macro to a
+ single arg macro which copies its arg. Fix all callers. Change
+ WARN and INFO to simply g_warning/g_message. Init G_LOG_DOMAIN
+ before including anything.
+
2003-04-01 Rodrigo Moya <rodrigo ximian com>
* backend/ebook/evolution-ldif-importer.c (load_file_fn):
Index: addressbook/conduit/address-conduit.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/conduit/address-conduit.c,v
retrieving revision 1.74
diff -u -3 -r1.74 address-conduit.c
--- addressbook/conduit/address-conduit.c 31 Mar 2003 15:44:56 -0000 1.74
+++ addressbook/conduit/address-conduit.c 3 Apr 2003 02:41:55 -0000
@@ -23,6 +23,8 @@
#include <config.h>
+#define G_LOG_DOMAIN "eaddrconduit"
+
#include <bonobo.h>
#include <libxml/parser.h>
#include <pi-source.h>
@@ -48,22 +50,18 @@
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
#define CONDUIT_VERSION "0.1.2"
-#ifdef G_LOG_DOMAIN
-#undef G_LOG_DOMAIN
-#endif
-#define G_LOG_DOMAIN "eaddrconduit"
#define DEBUG_CONDUIT 1
/* #undef DEBUG_CONDUIT */
#ifdef DEBUG_CONDUIT
-#define LOG(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e)
+#define LOG(x) x
#else
-#define LOG(e...)
+#define LOG(x)
#endif
-#define WARN(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, e)
-#define INFO(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e)
+#define WARN g_warning
+#define INFO g_message
typedef struct {
EBookStatus status;
@@ -867,7 +865,7 @@
g_assert (local->addr != NULL );
- LOG ("local_record_to_pilot_record\n");
+ LOG (g_message ( "local_record_to_pilot_record\n" ));
p.ID = local->local.ID;
p.category = local->local.category;
@@ -1231,7 +1229,7 @@
/* Or if the URI's don't match */
uri = e_book_get_uri (ctxt->ebook);
- LOG(" Current URI %s (%s)\n", uri, ctxt->cfg->last_uri ? ctxt->cfg->last_uri : "<NONE>");
+ LOG (g_message (" Current URI %s (%s)\n", uri, ctxt->cfg->last_uri ? ctxt->cfg->last_uri : "<NONE>"));
if (ctxt->cfg->last_uri != NULL && strcmp (ctxt->cfg->last_uri, uri)) {
gnome_pilot_conduit_standard_set_slow (conduit, TRUE);
e_pilot_map_clear (ctxt->map);
@@ -1239,9 +1237,9 @@
if (gnome_pilot_conduit_standard_get_slow (conduit)) {
ctxt->map->write_touched_only = TRUE;
- LOG (" doing slow sync\n");
+ LOG (g_message ( " doing slow sync\n" ));
} else {
- LOG (" doing fast sync\n");
+ LOG (g_message ( " doing fast sync\n" ));
}
}
@@ -1367,8 +1365,8 @@
abs_conduit = GNOME_PILOT_CONDUIT_SYNC_ABS (conduit);
- LOG ("---------------------------------------------------------\n");
- LOG ("pre_sync: Addressbook Conduit v.%s", CONDUIT_VERSION);
+ LOG (g_message ( "---------------------------------------------------------\n" ));
+ LOG (g_message ( "pre_sync: Addressbook Conduit v.%s", CONDUIT_VERSION ));
/* g_message ("Addressbook Conduit v.%s", CONDUIT_VERSION); */
ctxt->dbi = dbi;
@@ -1430,7 +1428,7 @@
{
gchar *filename, *change_id;
- LOG ("post_sync: Address Conduit v.%s", CONDUIT_VERSION);
+ LOG (g_message ( "post_sync: Address Conduit v.%s", CONDUIT_VERSION ));
g_free (ctxt->cfg->last_uri);
ctxt->cfg->last_uri = g_strdup (e_book_get_uri (ctxt->ebook));
@@ -1448,7 +1446,7 @@
g_free (change_id);
gtk_main ();
- LOG ("---------------------------------------------------------\n");
+ LOG (g_message ( "---------------------------------------------------------\n" ));
return 0;
}
@@ -1459,7 +1457,7 @@
guint32 ID,
EAddrConduitContext *ctxt)
{
- LOG ("set_pilot_id: setting to %d\n", ID);
+ LOG (g_message ( "set_pilot_id: setting to %d\n", ID ));
e_pilot_map_insert (ctxt->map, ID, local->ecard->id, FALSE);
@@ -1471,7 +1469,7 @@
EAddrLocalRecord *local,
EAddrConduitContext *ctxt)
{
- LOG ("set_status_cleared: clearing status\n");
+ LOG (g_message ( "set_status_cleared: clearing status\n" ));
g_hash_table_remove (ctxt->changed_hash, e_card_get_id (local->ecard));
@@ -1489,13 +1487,13 @@
g_return_val_if_fail (local != NULL, -1);
if (*local == NULL) {
- LOG ("beginning for_each");
+ LOG (g_message ( "beginning for_each" ));
cards = ctxt->cards;
count = 0;
if (cards != NULL) {
- LOG ("iterating over %d records", g_list_length (cards));
+ LOG (g_message ( "iterating over %d records", g_list_length (cards) ));
*local = g_new0 (EAddrLocalRecord, 1);
local_record_from_ecard (*local, cards->data, ctxt);
@@ -1503,7 +1501,7 @@
iterator = cards;
} else {
- LOG ("no events");
+ LOG (g_message ( "no events" ));
(*local) = NULL;
return 0;
}
@@ -1516,7 +1514,7 @@
local_record_from_ecard (*local, iterator->data, ctxt);
g_list_prepend (ctxt->locals, *local);
} else {
- LOG ("for_each ending");
+ LOG (g_message ( "for_each ending" ));
/* Tell the pilot the iteration is over */
*local = NULL;
@@ -1539,7 +1537,7 @@
g_return_val_if_fail (local != NULL, 0);
if (*local == NULL) {
- LOG ("for_each_modified beginning\n");
+ LOG (g_message ( "for_each_modified beginning\n" ));
iterator = ctxt->changed;
@@ -1549,13 +1547,13 @@
if (iterator != NULL) {
CardObjectChange *coc = iterator->data;
- LOG ("iterating over %d records", g_hash_table_size (ctxt->changed_hash));
+ LOG (g_message ( "iterating over %d records", g_hash_table_size (ctxt->changed_hash) ));
*local = g_new0 (EAddrLocalRecord, 1);
local_record_from_ecard (*local, coc->card, ctxt);
g_list_prepend (ctxt->locals, *local);
} else {
- LOG ("no events");
+ LOG (g_message ( "no events" ));
*local = NULL;
}
@@ -1569,7 +1567,7 @@
local_record_from_ecard (*local, coc->card, ctxt);
g_list_prepend (ctxt->locals, *local);
} else {
- LOG ("for_each_modified ending");
+ LOG (g_message ( "for_each_modified ending" ));
/* Signal the iteration is over */
*local = NULL;
@@ -1603,9 +1601,9 @@
retval = 1;
if (retval == 0)
- LOG (" equal");
+ LOG (g_message ( " equal" ));
else
- LOG (" not equal");
+ LOG (g_message ( " not equal" ));
return retval;
}
@@ -1621,7 +1619,7 @@
g_return_val_if_fail (remote != NULL, -1);
- LOG ("add_record: adding %s to desktop\n", print_remote (remote));
+ LOG (g_message ( "add_record: adding %s to desktop\n", print_remote (remote) ));
ecard = ecard_from_remote_record (ctxt, remote, NULL);
@@ -1711,7 +1709,7 @@
g_return_val_if_fail (local != NULL, -1);
g_return_val_if_fail (local->ecard != NULL, -1);
- LOG ("delete_record: delete %s\n", print_local (local));
+ LOG (g_message ( "delete_record: delete %s\n", print_local (local) ));
e_pilot_map_remove_by_uid (ctxt->map, local->ecard->id);
e_book_remove_card_by_id (ctxt->ebook, local->ecard->id, status_cb, &commit_status);
@@ -1734,7 +1732,7 @@
g_return_val_if_fail (local != NULL, -1);
- LOG ("archive_record: %s\n", archive ? "yes" : "no");
+ LOG (g_message ( "archive_record: %s\n", archive ? "yes" : "no" ));
e_pilot_map_insert (ctxt->map, local->local.ID, local->ecard->id, archive);
@@ -1761,7 +1759,7 @@
if (!uid)
return 0;
- LOG (" matched\n");
+ LOG (g_message ( " matched\n" ));
*local = g_new0 (EAddrLocalRecord, 1);
local_record_from_uid (*local, uid, ctxt);
@@ -1774,7 +1772,7 @@
EAddrLocalRecord *local,
EAddrConduitContext *ctxt)
{
- LOG ("free_match: freeing\n");
+ LOG (g_message ( "free_match: freeing\n" ));
g_return_val_if_fail (local != NULL, -1);
@@ -1789,7 +1787,7 @@
GnomePilotRecord *remote,
EAddrConduitContext *ctxt)
{
- LOG ("prepare: encoding local %s\n", print_local (local));
+ LOG (g_message ( "prepare: encoding local %s\n", print_local (local) ));
*remote = local_record_to_pilot_record (local, ctxt);
@@ -1811,7 +1809,7 @@
GtkWidget *parent,
EAddrConduitContext *ctxt)
{
- LOG ("create_settings_window");
+ LOG (g_message ( "create_settings_window" ));
ctxt->ps = e_pilot_settings_new ();
ctxt->gui = e_addr_gui_new (E_PILOT_SETTINGS (ctxt->ps));
@@ -1826,7 +1824,7 @@
static void
display_settings (GnomePilotConduit *conduit, EAddrConduitContext *ctxt)
{
- LOG ("display_settings");
+ LOG (g_message ( "display_settings" ));
fill_widgets (ctxt);
}
@@ -1834,7 +1832,7 @@
static void
save_settings (GnomePilotConduit *conduit, EAddrConduitContext *ctxt)
{
- LOG ("save_settings");
+ LOG (g_message ( "save_settings" ));
ctxt->new_cfg->secret =
e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps));
@@ -1846,7 +1844,7 @@
static void
revert_settings (GnomePilotConduit *conduit, EAddrConduitContext *ctxt)
{
- LOG ("revert_settings");
+ LOG (g_message ( "revert_settings" ));
addrconduit_save_configuration (ctxt->cfg);
addrconduit_destroy_configuration (ctxt->new_cfg);
@@ -1859,7 +1857,7 @@
GtkObject *retval;
EAddrConduitContext *ctxt;
- LOG ("in address's conduit_get_gpilot_conduit\n");
+ LOG (g_message ( "in address's conduit_get_gpilot_conduit\n" ));
retval = gnome_pilot_conduit_sync_abs_new ("AddressDB", 0x61646472);
g_assert (retval != NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]