gnokii-commit
[Top][All Lists]
Advanced

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

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-24


From: Pawel Kot
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-245-g896b10d
Date: Sun, 12 Jun 2011 17:56:38 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  896b10d1241f0fba314ecbb481cecb0cdb133c20 (commit)
      from  4052cf3b89ef76af017f0a6c91eb6c7a06160f29 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=896b10d1241f0fba314ecbb481cecb0cdb133c20


commit 896b10d1241f0fba314ecbb481cecb0cdb133c20
Author: Pawel Kot <address@hidden>
Date:   Sun Jun 12 19:53:57 2011 +0200

    Change:
        if (p)
                free(p);
    to:
        free(p);
    
    As per:
    
    FREE(3)
    NAME
           free - free dynamic memory
    SYNOPSIS
           #include <stdlib.h>
    
           void free(void *ptr);
    DESCRIPTION
           free()  frees the memory space pointed to by ptr, which must have 
been returned by a previous call to malloc(), calloc() or realloc().  Other‐
           wise, or if free(ptr) has already been called before, undefined 
behavior occurs.  If ptr is NULL, no operation is performed.

diff --git a/common/cfgreader.c b/common/cfgreader.c
index ab727c6..b688b1a 100644
--- a/common/cfgreader.c
+++ b/common/cfgreader.c
@@ -51,7 +51,7 @@ GNOKII_API struct gn_cfg_header *gn_cfg_info;
 static gn_config gn_config_default, gn_config_global;
 
 /* Handy macros */
-#define FREE(x)        do { if (x) free(x); (x) = NULL; } while (0)
+#define FREE(x)        do { free(x); (x) = NULL; } while (0)
 
 /*
  * Function to dump configuration pointed by @config
@@ -611,8 +611,7 @@ err_alloc:
 
 err_read:
        fclose(handle);
-       if (lines)
-               free(lines);
+       free(lines);
 
 out:
        return header;
@@ -1148,8 +1147,7 @@ static char **get_locations(int *retval)
        config_file_locations[(*retval)++] = strdup(path);
 
 out:
-       if (free_xdg_config_home)
-               free(xdg_config_home);
+       free(xdg_config_home);
 
        return config_file_locations;
 }
diff --git a/common/device.c b/common/device.c
index ca087fe..e81d9e4 100644
--- a/common/device.c
+++ b/common/device.c
@@ -120,10 +120,8 @@ void device_close(struct gn_statemachine *state)
                break;
        }
 
-       if (state->device.device_instance) {
-               free(state->device.device_instance);
-               state->device.device_instance = NULL;
-       }
+       free(state->device.device_instance);
+       state->device.device_instance = NULL;
 }
 
 void device_reset(struct gn_statemachine *state)
diff --git a/common/gsm-api.c b/common/gsm-api.c
index 2a9966b..cccce4b 100644
--- a/common/gsm-api.c
+++ b/common/gsm-api.c
@@ -107,8 +107,7 @@ static gn_error register_driver(gn_driver *driver, const 
char *model, char *setu
        if (strstr(driver->phone.models, model) != NULL)
                error = driver->functions(GN_OP_Init, p_data, sm);
 
-       if (data)
-               free(data);
+       free(data);
        return error;
 }
 
diff --git a/common/gsm-encoding.c b/common/gsm-encoding.c
index cf01c72..0cfecfe 100644
--- a/common/gsm-encoding.c
+++ b/common/gsm-encoding.c
@@ -1457,8 +1457,7 @@ int base64_encode(char *outstring, int outlen, const char 
*instring, int inlen)
        /* terminate the output string */
        *pout = 0;
 
-       if (outtemp)
-               free(outtemp);
+       free(outtemp);
 
        return pout - outstring;
 }
diff --git a/common/gsm-mms.c b/common/gsm-mms.c
index 4146a88..c0e76ac 100644
--- a/common/gsm-mms.c
+++ b/common/gsm-mms.c
@@ -613,8 +613,7 @@ gn_error gn_mms_nokia2txt(const unsigned char 
*source_buffer, size_t *source_len
                return error;
 
        error = gn_mms_pdu2txt(pdu_buffer, &pdu_length, dest_buffer, 
dest_length);
-       if (pdu_buffer)
-               free(pdu_buffer);
+       free(pdu_buffer);
 
        return error;
 }
@@ -640,8 +639,7 @@ gn_error gn_mms_nokia2mime(const unsigned char 
*source_buffer, size_t *source_le
                return error;
 
        error = gn_mms_pdu2mime(pdu_buffer, &pdu_length, dest_buffer, 
dest_length);
-       if (pdu_buffer)
-               free(pdu_buffer);
+       free(pdu_buffer);
 
        return error;
 }
diff --git a/common/gsm-sms.c b/common/gsm-sms.c
index a282df4..03f210e 100644
--- a/common/gsm-sms.c
+++ b/common/gsm-sms.c
@@ -1969,7 +1969,7 @@ char *encode_indication(gn_wap_push *wp, int *data_len)
        
        if (!data) {
                free(attr);
-           return NULL;
+               return NULL;
        }
        
        /* indication tag token */
@@ -2235,9 +2235,7 @@ GNOKII_API char *gn_sms2mbox(gn_sms *sms, char *from)
 
        return buf;
 error:
-       if (buf)
-               free(buf);
-       if (aux)
-               free(aux);
+       free(buf);
+       free(aux);
        return NULL;
 }
diff --git a/common/links/utils.c b/common/links/utils.c
index 27c1ab3..11c67ab 100644
--- a/common/links/utils.c
+++ b/common/links/utils.c
@@ -49,10 +49,8 @@ gn_error link_terminate(struct gn_statemachine *state)
        /* device_close(&(state->Device)); */
        if (state->link.cleanup)
                state->link.cleanup(state);
-       if (state->link.link_instance) {
-               free(state->link.link_instance);
-               state->link.link_instance = NULL;
-       }
+       free(state->link.link_instance);
+       state->link.link_instance = NULL;
        device_close(state);
        return GN_ERR_NONE; /* FIXME */
 }
diff --git a/common/phones/atgen.c b/common/phones/atgen.c
index 64b6aef..e50c8d3 100644
--- a/common/phones/atgen.c
+++ b/common/phones/atgen.c
@@ -1932,8 +1932,7 @@ static gn_error ReplyReadPhonebook(int messagetype, 
unsigned char *buffer, int l
                                /* not a fatal error */
                                data->phonebook_entry->date.year = 0;
                        }
-                       if (date_buf)
-                               free(date_buf);
+                       free(date_buf);
                }
        }
        return GN_ERR_NONE;
diff --git a/common/phones/nk6510.c b/common/phones/nk6510.c
index 6c61d5e..ab6673a 100644
--- a/common/phones/nk6510.c
+++ b/common/phones/nk6510.c
@@ -2141,12 +2141,10 @@ static gn_error NK6510_GetMMS_S40_30(gn_data *data, 
struct gn_statemachine *stat
                data->raw_mms->buffer_length = fi.file_length;
                data->raw_mms->buffer = fi.file;
 
-               if (fi.id)
-                       free(fi.id);
+               free(fi.id);
        }
        /* Do not free all fl.files[i] pointers because they are owned and 
shared by the cache */
-       if (fl.files)
-               free(fl.files);
+       free(fl.files);
 
        return error;
 }
diff --git a/common/vcal.c b/common/vcal.c
index 4699c80..8d0e0f6 100644
--- a/common/vcal.c
+++ b/common/vcal.c
@@ -274,8 +274,7 @@ norecurrence:
                }
                ical_append_printf(&str, "%s\n", icalstr);
                dprintf("%s\n", icalstr);
-               if (icalstrbuf)
-                       free(icalstrbuf);
+               free(icalstrbuf);
 
                icalcomponent_free(pIcal);
                pIcal = NULL;
@@ -380,7 +379,7 @@ GNOKII_API int gn_calnote2ical(FILE *f, gn_calnote *calnote)
        if (vcal == NULL)
                return -1;
        retval = fputs(vcal, f);
-       free (vcal);
+       free(vcal);
        return retval;
 }
 
diff --git a/gnokii/gnokii-sms.c b/gnokii/gnokii-sms.c
index 3744445..e8bbfda 100644
--- a/gnokii/gnokii-sms.c
+++ b/gnokii/gnokii-sms.c
@@ -358,8 +358,7 @@ gn_error sendsms(int argc, char *argv[], gn_data *data, 
struct gn_statemachine *
        } else
                fprintf(stderr, _("SMS Send failed (%s)\n"), 
gn_error_print(error));
 
-        if (sms.reference)
-               free(sms.reference);
+       free(sms.reference);
        return error;
 }
 
diff --git a/smsd/lowlevel.c b/smsd/lowlevel.c
index bbee084..98ab9d2 100644
--- a/smsd/lowlevel.c
+++ b/smsd/lowlevel.c
@@ -292,8 +292,7 @@ static gint A_SendSMSMessage (gpointer data)
   d->status = gn_sms_send (dt, sm);
   status = d->status;
   /* we do not use sms reference numbers in smsd */
-  if (dt->sms->reference)
-    free (dt->sms->reference);
+  free (dt->sms->reference);
   free (dt);
   pthread_cond_signal (&sendSMSCond);
   pthread_mutex_unlock (&sendSMSMutex);
diff --git a/xgnokii/xgnokii_lowlevel.c b/xgnokii/xgnokii_lowlevel.c
index 4d1dc5e..f6294cc 100644
--- a/xgnokii/xgnokii_lowlevel.c
+++ b/xgnokii/xgnokii_lowlevel.c
@@ -798,8 +798,7 @@ static gint A_SendSMSMessage(gpointer data)
        pthread_mutex_lock(&sendSMSMutex);
        error = d->status = gn_sms_send(&gdat, statemachine);
        /* we do not use sms reference numbers in xgnokii */
-       if (gdat.sms->reference)
-               free(gdat.sms->reference);
+       free(gdat.sms->reference);
        pthread_cond_signal(&sendSMSCond);
        pthread_mutex_unlock(&sendSMSMutex);
 

-----------------------------------------------------------------------

Summary of changes:
 common/cfgreader.c         |    8 +++-----
 common/device.c            |    6 ++----
 common/gsm-api.c           |    3 +--
 common/gsm-encoding.c      |    3 +--
 common/gsm-mms.c           |    6 ++----
 common/gsm-sms.c           |    8 +++-----
 common/links/utils.c       |    6 ++----
 common/phones/atgen.c      |    3 +--
 common/phones/nk6510.c     |    6 ++----
 common/vcal.c              |    5 ++---
 gnokii/gnokii-sms.c        |    3 +--
 smsd/lowlevel.c            |    3 +--
 xgnokii/xgnokii_lowlevel.c |    3 +--
 13 files changed, 22 insertions(+), 41 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

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