diff options
author | bertrand <Bertrand.Guiheneuf@aful.org> | 1999-09-01 19:53:18 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-09-01 19:53:18 +0800 |
commit | f5be7984b2ea1a4c3591cc11090220c080216aec (patch) | |
tree | 5b68ba93733115cc451adce0b674ececa9122f2c /camel | |
parent | a5dc758170c40d86ee361f607eae62aa6e7509d8 (diff) | |
download | gsoc2013-evolution-f5be7984b2ea1a4c3591cc11090220c080216aec.tar gsoc2013-evolution-f5be7984b2ea1a4c3591cc11090220c080216aec.tar.gz gsoc2013-evolution-f5be7984b2ea1a4c3591cc11090220c080216aec.tar.bz2 gsoc2013-evolution-f5be7984b2ea1a4c3591cc11090220c080216aec.tar.lz gsoc2013-evolution-f5be7984b2ea1a4c3591cc11090220c080216aec.tar.xz gsoc2013-evolution-f5be7984b2ea1a4c3591cc11090220c080216aec.tar.zst gsoc2013-evolution-f5be7984b2ea1a4c3591cc11090220c080216aec.zip |
When using g_free (obj) don't test if obj != NULL g_free () already do
1999-09-01 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/camel-folder.c (_finalize):
(_set_name):
* camel/camel-mime-message.c (_finalize):
* camel/camel-mime-part.c (_finalize):
(_set_description):
(_set_disposition):
* camel/camel-service.c (_finalize):
* camel/camel-stream-fs.c (_finalize):
* camel/gmime-content-field.c:
(gmime_content_field_construct_from_string):
* camel/url-util.c (g_url_free):
When using g_free (obj) don't test if obj != NULL
g_free () already do that. Thanks to elerium for
the feedback.
19
svn path=/trunk/; revision=1151
Diffstat (limited to 'camel')
-rw-r--r-- | camel/camel-folder.c | 12 | ||||
-rw-r--r-- | camel/camel-mime-message.c | 12 | ||||
-rw-r--r-- | camel/camel-mime-part.c | 33 | ||||
-rw-r--r-- | camel/camel-service.c | 2 | ||||
-rw-r--r-- | camel/camel-stream-fs.c | 2 | ||||
-rw-r--r-- | camel/gmime-content-field.c | 15 | ||||
-rw-r--r-- | camel/hash-table-utils.c | 2 | ||||
-rw-r--r-- | camel/url-util.c | 12 |
8 files changed, 43 insertions, 47 deletions
diff --git a/camel/camel-folder.c b/camel/camel-folder.c index d7f9390f1c..a25f783229 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -134,9 +134,9 @@ _finalize (GtkObject *object) CAMEL_LOG_FULL_DEBUG ("Entering CamelFolder::finalize\n"); - if (camel_folder->name) g_free (camel_folder->name); - if (camel_folder->full_name) g_free (camel_folder->full_name); - if (camel_folder->permanent_flags) g_free (camel_folder->permanent_flags); + g_free (camel_folder->name); + g_free (camel_folder->full_name); + g_free (camel_folder->permanent_flags); if (camel_folder->message_list) { /* unref all messages got from the folder */ message_node = camel_folder->message_list; @@ -217,8 +217,8 @@ _set_name (CamelFolder *folder, const gchar *name) g_assert (name); g_assert (folder->parent_store); - if (folder->name) g_free(folder->name); - if (folder->full_name) g_free (folder->full_name); + g_free (folder->name); + g_free (folder->full_name); separator = camel_store_get_separator (folder->parent_store); @@ -256,7 +256,7 @@ camel_folder_set_name (CamelFolder *folder, const gchar *name) static void _set_full_name (CamelFolder *folder, const gchar *name) { - if (folder->full_name) g_free(folder->full_name); + g_free(folder->full_name); folder->full_name = g_strdup (name); } diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c index 609bdb7e87..9ccf2fc9e4 100644 --- a/camel/camel-mime-message.c +++ b/camel/camel-mime-message.c @@ -184,11 +184,11 @@ _finalize (GtkObject *object) CamelMimeMessage *message = CAMEL_MIME_MESSAGE (object); CAMEL_LOG_FULL_DEBUG ("Entering CamelMimeMessage::finalize\n"); - if (message->received_date) g_free (message->received_date); - if (message->sent_date) g_free (message->sent_date); - if (message->subject) g_free (message->subject); - if (message->reply_to) g_free (message->reply_to); - if (message->from) g_free (message->from); + g_free (message->received_date); + g_free (message->sent_date); + g_free (message->subject); + g_free (message->reply_to); + g_free (message->from); #warning free recipients. if (message->folder) gtk_object_unref (GTK_OBJECT (message->folder)); @@ -221,7 +221,7 @@ static void _set_field (CamelMimeMessage *mime_message, gchar *name, gchar *value, gchar **variable) { if (variable) { - if (*variable) g_free (*variable); + g_free (*variable); *variable = value; } } diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index ff7781ba61..1068651da5 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -206,13 +206,13 @@ _finalize (GtkObject *object) - if (mime_part->description) g_free (mime_part->description); - if (mime_part->disposition) gmime_content_field_unref (mime_part->disposition); - if (mime_part->content_id) g_free (mime_part->content_id); - if (mime_part->content_MD5) g_free (mime_part->content_MD5); - if (mime_part->content_languages) string_list_free (mime_part->content_languages); - if (mime_part->encoding) g_free (mime_part->encoding); - if (mime_part->filename) g_free (mime_part->filename); + g_free (mime_part->description); + gmime_content_field_unref (mime_part->disposition); + g_free (mime_part->content_id); + g_free (mime_part->content_MD5); + string_list_free (mime_part->content_languages); + g_free (mime_part->encoding); + g_free (mime_part->filename); if (mime_part->header_lines) string_list_free (mime_part->header_lines); if (mime_part->content_type) gmime_content_field_unref (mime_part->content_type); @@ -248,7 +248,7 @@ _add_header (CamelMedium *medium, gchar *header_name, gchar *header_value) static void _set_description (CamelMimePart *mime_part, const gchar *description) { - if (mime_part->description) g_free (mime_part->description); + g_free (mime_part->description); mime_part->description = g_strdup (description); } @@ -285,10 +285,11 @@ static void _set_disposition (CamelMimePart *mime_part, const gchar *disposition) { #warning Do not use MimeContentfield here !!! - if (mime_part->disposition) g_free(mime_part->disposition); - if (!mime_part->disposition) - mime_part->disposition = g_new0 (GMimeContentField,1); - if ((mime_part->disposition)->type) g_free ((mime_part->disposition)->type); + + if (mime_part->disposition) g_free ((mime_part->disposition)->type); + g_free(mime_part->disposition); + + mime_part->disposition = g_new0 (GMimeContentField,1); (mime_part->disposition)->type = g_strdup (disposition); } @@ -323,7 +324,7 @@ camel_mime_part_get_disposition (CamelMimePart *mime_part) static void _set_filename (CamelMimePart *mime_part, gchar *filename) { - if (mime_part->filename) g_free(mime_part->filename); + g_free(mime_part->filename); mime_part->filename = filename; } @@ -360,7 +361,7 @@ camel_mime_part_get_filename (CamelMimePart *mime_part) static void _set_content_id (CamelMimePart *mime_part, gchar *content_id) { - if (mime_part->content_id) g_free(mime_part->content_id); + g_free(mime_part->content_id); mime_part->content_id = content_id; } @@ -386,7 +387,7 @@ camel_mime_part_get_content_id (CamelMimePart *mime_part) static void _set_content_MD5 (CamelMimePart *mime_part, gchar *content_MD5) { - if (mime_part->content_MD5) g_free(mime_part->content_MD5); + g_free(mime_part->content_MD5); mime_part->content_MD5 = content_MD5; } @@ -414,7 +415,7 @@ camel_mime_part_get_content_MD5 (CamelMimePart *mime_part) static void _set_encoding (CamelMimePart *mime_part, gchar *encoding) { - if (mime_part->encoding) g_free(mime_part->encoding); + g_free(mime_part->encoding); mime_part->encoding = encoding; } diff --git a/camel/camel-service.c b/camel/camel-service.c index 2ee0164b31..e1a45e309f 100644 --- a/camel/camel-service.c +++ b/camel/camel-service.c @@ -94,7 +94,7 @@ _finalize (GtkObject *object) CAMEL_LOG_FULL_DEBUG ("Entering CamelService::finalize\n"); - if (camel_service->url) g_free (camel_service->url); + g_free (camel_service->url); GTK_OBJECT_CLASS (parent_class)->finalize (object); CAMEL_LOG_FULL_DEBUG ("Leaving CamelService::finalize\n"); diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c index 8c62d516cc..e5fad1449f 100644 --- a/camel/camel-stream-fs.c +++ b/camel/camel-stream-fs.c @@ -137,7 +137,7 @@ _finalize (GtkObject *object) CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamFs::finalize\n"); - if (stream_fs->name) g_free (stream_fs->name); + g_free (stream_fs->name); GTK_OBJECT_CLASS (parent_class)->finalize (object); CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamFs::finalize\n"); diff --git a/camel/gmime-content-field.c b/camel/gmime-content-field.c index ad48880e7a..d838c5c8de 100644 --- a/camel/gmime-content-field.c +++ b/camel/gmime-content-field.c @@ -76,8 +76,8 @@ gmime_content_field_free (GMimeContentField *content_field) { g_assert (content_field); g_hash_table_foreach (content_field->parameters, _free_parameter, NULL); - if (content_field->type) g_free (content_field->type); - if (content_field->subtype) g_free (content_field->subtype); + g_free (content_field->type); + g_free (content_field->subtype); g_hash_table_destroy (content_field->parameters); g_free (content_field); } @@ -297,14 +297,9 @@ gmime_content_field_construct_from_string (GMimeContentField *content_field, con g_assert (string); g_assert (content_field); - if (content_field->type) { - CAMEL_LOG_FULL_DEBUG ( "GMimeContentField::construct_from_string, Freeing old mime type string\n"); - g_free (content_field->type); - } - if (content_field->subtype) { - CAMEL_LOG_FULL_DEBUG ( "GMimeContentField::construct_from_string, Freeing old mime type substring\n"); - g_free (content_field->subtype); - } + g_free (content_field->type); + g_free (content_field->subtype); + first = 0; len = strlen (string); diff --git a/camel/hash-table-utils.c b/camel/hash-table-utils.c index fb3743109b..b78ee062a4 100644 --- a/camel/hash-table-utils.c +++ b/camel/hash-table-utils.c @@ -35,7 +35,7 @@ void g_hash_table_generic_free (gpointer key, gpointer value, gpointer user_data) { g_free (key); - if (value) g_free (value); + g_free (value); } diff --git a/camel/url-util.c b/camel/url-util.c index b0a1f11d2d..a45f6f4962 100644 --- a/camel/url-util.c +++ b/camel/url-util.c @@ -124,12 +124,12 @@ g_url_free (Gurl *url) { g_assert (url); - if (url->protocol) g_free (url->protocol); - if (url->user) g_free (url->user); - if (url->passwd) g_free (url->passwd); - if (url->host) g_free (url->host); - if (url->port) g_free (url->port); - if (url->path) g_free (url->path); + g_free (url->protocol); + g_free (url->user); + g_free (url->passwd); + g_free (url->host); + g_free (url->port); + g_free (url->path); g_free (url); |