From a88ff5661a82f7a1cbdf9b824d2b12ad9a7992df Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Wed, 29 Nov 2000 03:49:12 +0000 Subject: Return a struct rather than a pointer to a struct (compare): 2000-11-28 JP Rosevear * conduits/todo/todo-conduit.c (local_record_to_pilot_record): Return a struct rather than a pointer to a struct (compare): local_record_to_pilot_record now returns a struct (prepare): ditto (free_prepare): remove as per gnome-pilot changes (conduit_get_gpilot_conduit): don't listen for free_prepare signal * conduits/calendar/calendar-conduit.c: Same as above 2000-11-28 JP Rosevear * conduit/address-conduit.c (local_record_to_pilot_record): Return a struct rather than a pointer to a struct (view_cb): kill warning (compare): local_record_to_pilot_record now returns a struct (prepare): ditto (free_prepare): remove as per gnome-pilot changes (conduit_get_gpilot_conduit): don't listen for free_prepare signal svn path=/trunk/; revision=6708 --- calendar/conduits/calendar/calendar-conduit.c | 51 ++++++++------------------- calendar/conduits/todo/todo-conduit.c | 51 ++++++++------------------- 2 files changed, 28 insertions(+), 74 deletions(-) (limited to 'calendar/conduits') diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index 6e903b14f1..41dd1e6cf2 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -53,7 +53,7 @@ GnomePilotConduit * conduit_get_gpilot_conduit (guint32); void conduit_destroy_gpilot_conduit (GnomePilotConduit*); -#define CONDUIT_VERSION "0.1.0" +#define CONDUIT_VERSION "0.1.1" #ifdef G_LOG_DOMAIN #undef G_LOG_DOMAIN #endif @@ -280,29 +280,26 @@ compute_status (ECalConduitContext *ctxt, ECalLocalRecord *local, const char *ui } } -static GnomePilotRecord * +static GnomePilotRecord local_record_to_pilot_record (ECalLocalRecord *local, ECalConduitContext *ctxt) { - GnomePilotRecord *p = NULL; + GnomePilotRecord p; - g_return_val_if_fail (local != NULL, NULL); g_assert (local->comp != NULL); g_assert (local->appt != NULL ); LOG ("local_record_to_remote_record\n"); - p = g_new0 (GnomePilotRecord, 1); - - p->ID = local->local.ID; - p->category = 0; - p->attr = local->local.attr; - p->archived = local->local.archived; - p->secret = local->local.secret; + p.ID = local->local.ID; + p.category = 0; + p.attr = local->local.attr; + p.archived = local->local.archived; + p.secret = local->local.secret; /* Generate pilot record structure */ - p->record = g_new0 (char,0xffff); - p->length = pack_Appointment (local->appt, p->record, 0xffff); + p.record = g_new0 (char, 0xffff); + p.length = pack_Appointment (local->appt, p.record, 0xffff); return p; } @@ -875,7 +872,7 @@ compare (GnomePilotConduitSyncAbs *conduit, ECalConduitContext *ctxt) { /* used by the quick compare */ - GnomePilotRecord *local_pilot; + GnomePilotRecord local_pilot; int retval = 0; LOG ("compare: local=%s remote=%s...\n", @@ -885,11 +882,9 @@ compare (GnomePilotConduitSyncAbs *conduit, g_return_val_if_fail (remote!=NULL,-1); local_pilot = local_record_to_pilot_record (local, ctxt); - if (!local_pilot) - return -1; - if (remote->length != local_pilot->length - || memcmp (local_pilot->record, remote->record, remote->length)) + if (remote->length != local_pilot.length + || memcmp (local_pilot.record, remote->record, remote->length)) retval = 1; if (retval == 0) @@ -897,8 +892,6 @@ compare (GnomePilotConduitSyncAbs *conduit, else LOG (" not equal"); - g_free (local_pilot); - return retval; } @@ -1031,31 +1024,16 @@ free_match (GnomePilotConduitSyncAbs *conduit, static gint prepare (GnomePilotConduitSyncAbs *conduit, ECalLocalRecord *local, - GnomePilotRecord **remote, + GnomePilotRecord *remote, ECalConduitContext *ctxt) { LOG ("prepare: encoding local %s\n", print_local (local)); *remote = local_record_to_pilot_record (local, ctxt); - if (!*remote) - return -1; - return 0; } -static gint -free_prepare (GnomePilotConduitSyncAbs *conduit, - GnomePilotRecord *remote, - ECalConduitContext *ctxt) -{ - LOG ("free_prepare: freeing\n"); - - g_return_val_if_fail (remote != NULL, -1); - - return 0; -} - static ORBit_MessageValidationResult accept_all_cookies (CORBA_unsigned_long request_id, CORBA_Principal *principal, @@ -1117,7 +1095,6 @@ conduit_get_gpilot_conduit (guint32 pilot_id) gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, ctxt); gtk_signal_connect (retval, "prepare", (GtkSignalFunc) prepare, ctxt); - gtk_signal_connect (retval, "free_prepare", (GtkSignalFunc) free_prepare, ctxt); return GNOME_PILOT_CONDUIT (retval); } diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c index 0884af229d..df0d6bfb8e 100644 --- a/calendar/conduits/todo/todo-conduit.c +++ b/calendar/conduits/todo/todo-conduit.c @@ -53,7 +53,7 @@ GnomePilotConduit * conduit_get_gpilot_conduit (guint32); void conduit_destroy_gpilot_conduit (GnomePilotConduit*); -#define CONDUIT_VERSION "0.1.0" +#define CONDUIT_VERSION "0.1.1" #ifdef G_LOG_DOMAIN #undef G_LOG_DOMAIN #endif @@ -259,29 +259,26 @@ compute_status (EToDoConduitContext *ctxt, EToDoLocalRecord *local, const char * } } -static GnomePilotRecord * +static GnomePilotRecord local_record_to_pilot_record (EToDoLocalRecord *local, EToDoConduitContext *ctxt) { - GnomePilotRecord *p = NULL; + GnomePilotRecord p; - g_return_val_if_fail (local != NULL, NULL); g_assert (local->comp != NULL); g_assert (local->todo != NULL ); LOG ("local_record_to_pilot_record\n"); - p = g_new0 (GnomePilotRecord, 1); - - p->ID = local->local.ID; - p->category = 0; - p->attr = local->local.attr; - p->archived = local->local.archived; - p->secret = local->local.secret; + p.ID = local->local.ID; + p.category = 0; + p.attr = local->local.attr; + p.archived = local->local.archived; + p.secret = local->local.secret; /* Generate pilot record structure */ - p->record = g_new0 (char,0xffff); - p->length = pack_ToDo (local->todo, p->record, 0xffff); + p.record = g_new0 (char, 0xffff); + p.length = pack_ToDo (local->todo, p.record, 0xffff); return p; } @@ -749,7 +746,7 @@ compare (GnomePilotConduitSyncAbs *conduit, EToDoConduitContext *ctxt) { /* used by the quick compare */ - GnomePilotRecord *local_pilot; + GnomePilotRecord local_pilot; int retval = 0; LOG ("compare: local=%s remote=%s...\n", @@ -759,11 +756,9 @@ compare (GnomePilotConduitSyncAbs *conduit, g_return_val_if_fail (remote!=NULL,-1); local_pilot = local_record_to_pilot_record (local, ctxt); - if (!local_pilot) - return -1; - if (remote->length != local_pilot->length - || memcmp (local_pilot->record, remote->record, remote->length)) + if (remote->length != local_pilot.length + || memcmp (local_pilot.record, remote->record, remote->length)) retval = 1; if (retval == 0) @@ -771,8 +766,6 @@ compare (GnomePilotConduitSyncAbs *conduit, else LOG (" not equal"); - g_free (local_pilot); - return retval; } @@ -905,31 +898,16 @@ free_match (GnomePilotConduitSyncAbs *conduit, static gint prepare (GnomePilotConduitSyncAbs *conduit, EToDoLocalRecord *local, - GnomePilotRecord **remote, + GnomePilotRecord *remote, EToDoConduitContext *ctxt) { LOG ("prepare: encoding local %s\n", print_local (local)); *remote = local_record_to_pilot_record (local, ctxt); - if (!*remote) - return -1; - return 0; } -static gint -free_prepare (GnomePilotConduitSyncAbs *conduit, - GnomePilotRecord *remote, - EToDoConduitContext *ctxt) -{ - LOG ("free_prepare: freeing\n"); - - g_return_val_if_fail (remote != NULL, -1); - - return 0; -} - static ORBit_MessageValidationResult accept_all_cookies (CORBA_unsigned_long request_id, CORBA_Principal *principal, @@ -991,7 +969,6 @@ conduit_get_gpilot_conduit (guint32 pilot_id) gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, ctxt); gtk_signal_connect (retval, "prepare", (GtkSignalFunc) prepare, ctxt); - gtk_signal_connect (retval, "free_prepare", (GtkSignalFunc) free_prepare, ctxt); return GNOME_PILOT_CONDUIT (retval); } -- cgit