aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>1999-12-09 10:35:42 +0800
committerEttore Perazzoli <ettore@src.gnome.org>1999-12-09 10:35:42 +0800
commit54e2b5022a8eca59e4aac0d5b0d3cb125d54c008 (patch)
tree5d581d09b10c89cddd268154adf6524eb581c1aa
parent98b072ccedab8676f555b26d904bf95435f381f6 (diff)
downloadgsoc2013-evolution-54e2b5022a8eca59e4aac0d5b0d3cb125d54c008.tar
gsoc2013-evolution-54e2b5022a8eca59e4aac0d5b0d3cb125d54c008.tar.gz
gsoc2013-evolution-54e2b5022a8eca59e4aac0d5b0d3cb125d54c008.tar.bz2
gsoc2013-evolution-54e2b5022a8eca59e4aac0d5b0d3cb125d54c008.tar.lz
gsoc2013-evolution-54e2b5022a8eca59e4aac0d5b0d3cb125d54c008.tar.xz
gsoc2013-evolution-54e2b5022a8eca59e4aac0d5b0d3cb125d54c008.tar.zst
gsoc2013-evolution-54e2b5022a8eca59e4aac0d5b0d3cb125d54c008.zip
Make set_* methods in CamelMimeMessage use const strings.
svn path=/trunk/; revision=1477
-rw-r--r--ChangeLog19
-rw-r--r--camel/camel-mime-message.c29
-rw-r--r--camel/camel-mime-message.h14
3 files changed, 41 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 504762e26f..aa4339ed5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+1999-12-08 Ettore Perazzoli <ettore@gnu.org>
+
+ * tests/test1.c (main): Removed the strdup()s, which are not
+ deeded anymore.
+
+ * camel/camel-mime-message.c (_set_subject): `subject' made const.
+ (camel_mime_message_set_subject): Likewise.
+ (_set_from): `from' made const.
+ (camel_mime_message_set_from): Likewise.
+ (_set_reply_to): Made `reply_to' const.
+ (camel_mime_message_set_reply_to): Likewise.
+ (_set_set_received_date): Made `received_date' const.
+ (camel_mime_message_set_reply_to): Likewise.
+ (_set_field): `value' made const. Also, strdup the string before
+ assigning.
+
+ * camel/camel-mime-message.h: Virtual methods changed to use const
+ strings when setting header values.
+
1999-11-17 Ettore Perazzoli <ettore@gnu.org>
* composer/Makefile.am (EXTRA_DIST): Added `$(glade_DATA)'.
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index 8a5928c542..9313f96232 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -55,14 +55,14 @@ static gchar *reply_to_str;
static gchar *subject_str;
static gchar *from_str;
-static void _set_received_date (CamelMimeMessage *mime_message, gchar *received_date);
+static void _set_received_date (CamelMimeMessage *mime_message, const gchar *received_date);
static const gchar *_get_received_date (CamelMimeMessage *mime_message);
static const gchar *_get_sent_date (CamelMimeMessage *mime_message);
-static void _set_reply_to (CamelMimeMessage *mime_message, gchar *reply_to);
+static void _set_reply_to (CamelMimeMessage *mime_message, const gchar *reply_to);
static const gchar *_get_reply_to (CamelMimeMessage *mime_message);
-static void _set_subject (CamelMimeMessage *mime_message, gchar *subject);
+static void _set_subject (CamelMimeMessage *mime_message, const gchar *subject);
static const gchar *_get_subject (CamelMimeMessage *mime_message);
-static void _set_from (CamelMimeMessage *mime_message, gchar *from);
+static void _set_from (CamelMimeMessage *mime_message, const gchar *from);
static const gchar *_get_from (CamelMimeMessage *mime_message);
static void _add_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
static void _remove_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
@@ -221,11 +221,11 @@ camel_mime_message_new_with_session (CamelSession *session)
/* some utils func */
static void
-_set_field (CamelMimeMessage *mime_message, gchar *name, gchar *value, gchar **variable)
+_set_field (CamelMimeMessage *mime_message, gchar *name, const gchar *value, gchar **variable)
{
if (variable) {
g_free (*variable);
- *variable = value;
+ *variable = g_strdup (value);
}
}
@@ -250,13 +250,13 @@ _check_not_expunged (CamelMimeMessage *mime_message)
static void
-_set_received_date (CamelMimeMessage *mime_message, gchar *received_date)
+_set_received_date (CamelMimeMessage *mime_message, const gchar *received_date)
{
_set_field (mime_message, received_date_str, received_date, &(mime_message->received_date));
}
void
-camel_mime_message_set_received_date (CamelMimeMessage *mime_message, gchar *received_date)
+camel_mime_message_set_received_date (CamelMimeMessage *mime_message, const gchar *received_date)
{
g_assert (mime_message);
g_return_if_fail (_check_not_expunged (mime_message));
@@ -295,13 +295,13 @@ camel_mime_message_get_sent_date (CamelMimeMessage *mime_message)
static void
-_set_reply_to (CamelMimeMessage *mime_message, gchar *reply_to)
+_set_reply_to (CamelMimeMessage *mime_message, const gchar *reply_to)
{
_set_field (mime_message, reply_to_str, reply_to, &(mime_message->reply_to));
}
void
-camel_mime_message_set_reply_to (CamelMimeMessage *mime_message, gchar *reply_to)
+camel_mime_message_set_reply_to (CamelMimeMessage *mime_message, const gchar *reply_to)
{
g_assert (mime_message);
g_return_if_fail (_check_not_expunged (mime_message));
@@ -327,13 +327,14 @@ camel_mime_message_get_reply_to (CamelMimeMessage *mime_message)
static void
-_set_subject (CamelMimeMessage *mime_message, gchar *subject)
+_set_subject (CamelMimeMessage *mime_message, const gchar *subject)
{
_set_field (mime_message, subject_str, subject, &(mime_message->subject));
}
void
-camel_mime_message_set_subject (CamelMimeMessage *mime_message, gchar *subject)
+camel_mime_message_set_subject (CamelMimeMessage *mime_message,
+ const gchar *subject)
{
g_assert (mime_message);
g_return_if_fail (_check_not_expunged (mime_message));
@@ -359,13 +360,13 @@ camel_mime_message_get_subject (CamelMimeMessage *mime_message)
static void
-_set_from (CamelMimeMessage *mime_message, gchar *from)
+_set_from (CamelMimeMessage *mime_message, const gchar *from)
{
_set_field (mime_message, from_str, from, &(mime_message->from));
}
void
-camel_mime_message_set_from (CamelMimeMessage *mime_message, gchar *from)
+camel_mime_message_set_from (CamelMimeMessage *mime_message, const gchar *from)
{
g_assert (mime_message);
g_return_if_fail (_check_not_expunged (mime_message));
diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h
index e233f99899..cdc9e3e7e6 100644
--- a/camel/camel-mime-message.h
+++ b/camel/camel-mime-message.h
@@ -90,11 +90,11 @@ typedef struct {
void (*set_received_date) (CamelMimeMessage *mime_message, gchar *received_date);
const gchar * (*get_received_date) (CamelMimeMessage *mime_message);
const gchar * (*get_sent_date) (CamelMimeMessage *mime_message);
- void (*set_reply_to) (CamelMimeMessage *mime_message, gchar *reply_to);
+ void (*set_reply_to) (CamelMimeMessage *mime_message, const gchar *reply_to);
const gchar * (*get_reply_to) (CamelMimeMessage *mime_message);
- void (*set_subject) (CamelMimeMessage *mime_message, gchar *subject);
+ void (*set_subject) (CamelMimeMessage *mime_message, const gchar *subject);
const gchar * (*get_subject) (CamelMimeMessage *mime_message);
- void (*set_from) (CamelMimeMessage *mime_message, gchar *from);
+ void (*set_from) (CamelMimeMessage *mime_message, const gchar *from);
const gchar * (*get_from) (CamelMimeMessage *mime_message);
void (*add_recipient) (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
void (*remove_recipient) (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
@@ -116,14 +116,14 @@ GtkType camel_mime_message_get_type (void);
CamelMimeMessage *camel_mime_message_new_with_session (CamelSession *session);
-void camel_mime_message_set_received_date (CamelMimeMessage *mime_message, gchar *received_date);
+void camel_mime_message_set_received_date (CamelMimeMessage *mime_message, const gchar *received_date);
const gchar *camel_mime_message_get_received_date (CamelMimeMessage *mime_message);
const gchar *camel_mime_message_get_sent_date (CamelMimeMessage *mime_message);
-void camel_mime_message_set_reply_to (CamelMimeMessage *mime_message, gchar *reply_to);
+void camel_mime_message_set_reply_to (CamelMimeMessage *mime_message, const gchar *reply_to);
const gchar *camel_mime_message_get_reply_to (CamelMimeMessage *mime_message);
-void camel_mime_message_set_subject (CamelMimeMessage *mime_message, gchar *subject);
+void camel_mime_message_set_subject (CamelMimeMessage *mime_message, const gchar *subject);
const gchar *camel_mime_message_get_subject (CamelMimeMessage *mime_message);
-void camel_mime_message_set_from (CamelMimeMessage *mime_message, gchar *from);
+void camel_mime_message_set_from (CamelMimeMessage *mime_message, const gchar *from);
const gchar *camel_mime_message_get_from (CamelMimeMessage *mime_message);
void camel_mime_message_add_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);