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
This commit is contained in:
bertrand
1999-09-01 11:53:18 +00:00
committed by Bertrand Guiheneuf
parent a5dc758170
commit f5be7984b2
10 changed files with 66 additions and 52 deletions

View File

@ -1,3 +1,21 @@
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.
1999-08-30 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/camel-recipient.c (camel_recipient_get):

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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");

View File

@ -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");

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -4,11 +4,11 @@ AM_CONFIG_HEADER(config.h)
cflags_set=${CFLAGS+set}
MAJOR_VERSION=1
MINOR_VERSION=0
MICRO_VERSION=1
VERSION=$OBGNOME_MAJOR_VERSION.$OBGNOME_MINOR_VERSION.$OBGNOME_MICRO_VERSION
PACKAGE=gnome-mailer
EVOLUTION_MAJOR_VERSION=0
EVOLUTION_MINOR_VERSION=0
EVOLUTION_MICRO_VERSION=1
VERSION=$EVOLUTION_MAJOR_VERSION.$EVOLUTION_MINOR_VERSION.$EVOLUTION_MICRO_VERSION
PACKAGE=evolution
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AC_SUBST(VERSION)