[empathy: 88/148] Use != NULL for pointer checks.



commit ff229c47dcee18e2723aae6f3b5cd513f79ae503
Author: Cosimo Cecchi <cosimo cecchi collabora co uk>
Date:   Fri May 15 18:34:59 2009 +0200

    Use != NULL for pointer checks.
---
 libempathy/empathy-ft-factory.c |    2 +-
 libempathy/empathy-ft-handler.c |   14 +++++++-------
 libempathy/empathy-tp-file.c    |   32 ++++++++++++++++----------------
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/libempathy/empathy-ft-factory.c b/libempathy/empathy-ft-factory.c
index 89ee446..fe687d1 100644
--- a/libempathy/empathy-ft-factory.c
+++ b/libempathy/empathy-ft-factory.c
@@ -48,7 +48,7 @@ do_constructor (GType type,
 {
 	GObject *retval;
 
-	if (factory_singleton) {
+	if (factory_singleton != NULL) {
 		retval = g_object_ref (factory_singleton);
 	} else {
 		retval = G_OBJECT_CLASS (empathy_ft_factory_parent_class)->constructor
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index 98e4dc6..29b3387 100644
--- a/libempathy/empathy-ft-handler.c
+++ b/libempathy/empathy-ft-handler.c
@@ -177,23 +177,23 @@ do_dispose (GObject *object)
 
   priv->dispose_run = TRUE;
 
-  if (priv->contact) {
+  if (priv->contact != NULL) {
     g_object_unref (priv->contact);
     priv->contact = NULL;
   }
 
-  if (priv->gfile) {
+  if (priv->gfile != NULL) {
     g_object_unref (priv->gfile);
     priv->gfile = NULL;
   }
 
-  if (priv->tpfile) {
+  if (priv->tpfile != NULL) {
     empathy_tp_file_close (priv->tpfile);
     g_object_unref (priv->tpfile);
     priv->tpfile = NULL;
   }
 
-  if (priv->cancellable) {
+  if (priv->cancellable != NULL) {
     g_object_unref (priv->cancellable);
     priv->cancellable = NULL;
   }
@@ -753,7 +753,7 @@ again:
   }
 
 out:
-  if (error)
+  if (error != NULL)
     hash_data->error = error;
 
   g_io_scheduler_job_send_to_mainloop_async (job, hash_job_done,
@@ -778,7 +778,7 @@ do_hash_job_incoming (GIOSchedulerJob *job,
   hash_data->stream =
     G_INPUT_STREAM (g_file_read (priv->gfile, cancellable, &error));
 
-  if (error)
+  if (error != NULL)
     {
       hash_data->error = error;
       g_io_scheduler_job_send_to_mainloop_async (job, hash_job_done,
@@ -868,7 +868,7 @@ callbacks_data_free (gpointer user_data)
 {
   CallbacksData *data = user_data;
 
-  if (data->handler)
+  if (data->handler != NULL)
     g_object_unref (data->handler);
 
   g_slice_free (CallbacksData, data);
diff --git a/libempathy/empathy-tp-file.c b/libempathy/empathy-tp-file.c
index d9d7005..e44f8e2 100644
--- a/libempathy/empathy-tp-file.c
+++ b/libempathy/empathy-tp-file.c
@@ -124,7 +124,7 @@ tp_file_get_state_cb (TpProxy *proxy,
 {
   EmpathyTpFilePriv *priv = GET_PRIV (weak_object);
 
-  if (error)
+  if (error != NULL)
     {
       /* set a default value for the state */
       priv->state = TP_FILE_TRANSFER_STATE_NONE;
@@ -164,10 +164,10 @@ ft_operation_close_clean (EmpathyTpFile *tp_file)
 
   if (priv->is_closed)
     return;
-  else
-    priv->is_closed = TRUE;
 
-  if (priv->op_callback)
+  priv->is_closed = TRUE;
+
+  if (priv->op_callback != NULL)
     priv->op_callback (tp_file, NULL, priv->op_user_data);
 }
 
@@ -181,14 +181,14 @@ ft_operation_close_with_error (EmpathyTpFile *tp_file,
 
   if (priv->is_closed)
     return;
-  else
-    priv->is_closed = TRUE;
+
+  priv->is_closed = TRUE;
 
   /* close the channel if it's not cancelled already */
   if (priv->state != TP_FILE_TRANSFER_STATE_CANCELLED)
     empathy_tp_file_cancel (tp_file);
 
-  if (priv->op_callback)
+  if (priv->op_callback != NULL)
     priv->op_callback (tp_file, error, priv->op_user_data);
 }
 
@@ -264,7 +264,7 @@ tp_file_start_transfer (EmpathyTpFile *tp_file)
   priv->start_time = empathy_time_get_current ();
 
   /* notify we're starting a transfer */
-  if (priv->progress_callback)
+  if (priv->progress_callback != NULL)
     priv->progress_callback (tp_file, 0, priv->progress_user_data);
 
   if (priv->incoming)
@@ -392,7 +392,7 @@ tp_file_transferred_bytes_changed_cb (TpChannel *proxy,
     return;
 
   /* notify clients */
-  if (priv->progress_callback)
+  if (priv->progress_callback != NULL)
     priv->progress_callback (EMPATHY_TP_FILE (weak_object),
         count, priv->progress_user_data);
 }
@@ -410,9 +410,9 @@ ft_operation_provide_or_accept_file_cb (TpChannel *proxy,
 
   g_cancellable_set_error_if_cancelled (priv->cancellable, &myerr);
 
-  if (error)
+  if (error != NULL)
     {
-      if (myerr)
+      if (myerr != NULL)
         {
           /* if we were both cancelled and failed when calling the method,
           * report the method error.
@@ -422,7 +422,7 @@ ft_operation_provide_or_accept_file_cb (TpChannel *proxy,
         }
     }
 
-  if (myerr)
+  if (myerr != NULL)
     {
       DEBUG ("Error: %s", error->message);
       ft_operation_close_with_error (tp_file, myerr);
@@ -575,7 +575,7 @@ do_dispose (GObject *object)
 
   priv->dispose_run = TRUE;
 
-  if (priv->channel)
+  if (priv->channel != NULL)
     {
       g_signal_handlers_disconnect_by_func (priv->channel,
           tp_file_invalidated_cb, object);
@@ -583,13 +583,13 @@ do_dispose (GObject *object)
       priv->channel = NULL;
     }
 
-  if (priv->in_stream)
+  if (priv->in_stream != NULL)
     g_object_unref (priv->in_stream);
 
-  if (priv->out_stream)
+  if (priv->out_stream != NULL)
     g_object_unref (priv->out_stream);
 
-  if (priv->cancellable)
+  if (priv->cancellable != NULL)
     g_object_unref (priv->cancellable);
 
   G_OBJECT_CLASS (empathy_tp_file_parent_class)->dispose (object);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]