pspp-dev
[Top][All Lists]
Advanced

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

Re: [datasets 10/18] gui: Prefer NULL to 0 for initializing pointers.


From: John Darrington
Subject: Re: [datasets 10/18] gui: Prefer NULL to 0 for initializing pointers.
Date: Sun, 1 May 2011 11:15:21 +0000
User-agent: Mutt/1.5.18 (2008-05-17)

If we were using C++ I'd have to disagree.

C doesn't have the same typecasting semantics so
doesn't matter so much.  However, sometimes I've
had problems porting programs which use NULL, becauase
different Oses define it in different headers.
On Sat, Apr 30, 2011 at 10:36:38PM -0700, Ben Pfaff wrote:
     Using NULL instead of 0 is better modern C style.
     ---
      src/ui/gui/helper.c               |    2 +-
      src/ui/gui/val-labs-dialog.c      |    8 ++++----
      src/ui/gui/var-display.c          |    2 +-
      src/ui/gui/variable-info-dialog.c |    2 +-
      4 files changed, 7 insertions(+), 7 deletions(-)
     
     diff --git a/src/ui/gui/helper.c b/src/ui/gui/helper.c
     index 36165c7..75954fb 100644
     --- a/src/ui/gui/helper.c
     +++ b/src/ui/gui/helper.c
     @@ -52,7 +52,7 @@
      gchar *
      value_to_text (union value v, const PsppireDict *dict, struct fmt_spec 
format)
      {
     -  gchar *s = 0;
     +  gchar *s = NULL;
      
        s = data_out (&v, dict_get_encoding (dict->dict),  &format);
        g_strchug (s);
     diff --git a/src/ui/gui/val-labs-dialog.c b/src/ui/gui/val-labs-dialog.c
     index 605be36..950a59e 100644
     --- a/src/ui/gui/val-labs-dialog.c
     +++ b/src/ui/gui/val-labs-dialog.c
     @@ -1,5 +1,5 @@
      /* PSPPIRE - a graphical user interface for PSPP.
     -   Copyright (C) 2005, 2009, 2011  Free Software Foundation
     +   Copyright (C) 2005, 2009, 2010, 2011  Free Software Foundation
      
         This program is free software: you can redistribute it and/or modify
         it under the terms of the GNU General Public License as published by
     @@ -192,7 +192,7 @@ val_labs_ok (GtkWidget *w, gpointer data)
      
        val_labs_destroy (dialog->labs);
      
     -  dialog->labs = 0;
     +  dialog->labs = NULL;
      
        gtk_widget_hide (dialog->window);
      
     @@ -206,7 +206,7 @@ val_labs_cancel (struct val_labs_dialog *dialog)
      {
        val_labs_destroy (dialog->labs);
      
     -  dialog->labs = 0;
     +  dialog->labs = NULL;
      
        gtk_widget_hide (dialog->window);
      }
     @@ -461,7 +461,7 @@ val_labs_dialog_create (GtkWindow *toplevel, 
PsppireVarStore *var_store)
        g_signal_connect (dialog->add_button, "clicked",
                   G_CALLBACK (on_add), dialog);
      
     -  dialog->labs = 0;
     +  dialog->labs = NULL;
      
        g_object_unref (xml);
      
     diff --git a/src/ui/gui/var-display.c b/src/ui/gui/var-display.c
     index 26de981..5f85af2 100644
     --- a/src/ui/gui/var-display.c
     +++ b/src/ui/gui/var-display.c
     @@ -69,7 +69,7 @@ missing_values_to_string (const PsppireDict *dict, const 
struct variable *pv, GE
      
          if ( mv_has_value (miss))
            {
     -        gchar *ss = 0;
     +        gchar *ss = NULL;
      
              ss = value_to_text (*mv_get_value (miss, 0), dict, *fmt);
      
     diff --git a/src/ui/gui/variable-info-dialog.c 
b/src/ui/gui/variable-info-dialog.c
     index 37f501a..3692a0d 100644
     --- a/src/ui/gui/variable-info-dialog.c
     +++ b/src/ui/gui/variable-info-dialog.c
     @@ -55,7 +55,7 @@ label_to_string (const struct variable *var)
      static void
      populate_text (PsppireDictView *treeview, gpointer data)
      {
     -  gchar *text = 0;
     +  gchar *text = NULL;
        GString *gstring;
        PsppireDict *dict;
      
     -- 
     1.7.2.5
     
     
     _______________________________________________
     pspp-dev mailing list
     address@hidden
     https://lists.gnu.org/mailman/listinfo/pspp-dev

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]