diff libpurple/protocols/myspace/message.c @ 24728:c1c464583f8c

Mark some parameters as const char * instead of char * and don't needlessly strdup
author Mark Doliner <mark@kingant.net>
date Tue, 16 Dec 2008 01:40:38 +0000
parents 68cc1a8a0d21
children 5f8e8b89b143
line wrap: on
line diff
--- a/libpurple/protocols/myspace/message.c	Tue Dec 16 01:03:24 2008 +0000
+++ b/libpurple/protocols/myspace/message.c	Tue Dec 16 01:40:38 2008 +0000
@@ -1005,7 +1005,7 @@
  * @return MsimMessage *. Caller should msim_msg_free() when done.
  */
 MsimMessage *
-msim_parse(gchar *raw)
+msim_parse(const gchar *raw)
 {
 	MsimMessage *msg;
 	gchar *token;
@@ -1026,7 +1026,6 @@
 				"missing initial backslash: <%s>\n", raw);
 		/* XXX: Should we try to recover, and read to first backslash? */
 
-		g_free(raw);
 		return NULL;
 	}
 
@@ -1057,9 +1056,6 @@
 	}
 	g_strfreev(tokens);
 
-	/* Can free now since all data was copied to hash key/values */
-	g_free(raw);
-
 	return msg;
 }
 
@@ -1214,8 +1210,8 @@
  *
  * @return A new MsimMessage *. Must msim_msg_free() when done.
  */
-MsimMessage *
-msim_msg_dictionary_parse(gchar *raw)
+static MsimMessage *
+msim_msg_dictionary_parse(const gchar *raw)
 {
 	MsimMessage *dict;
 	gchar *item;
@@ -1275,7 +1271,7 @@
 			return msim_msg_clone((MsimMessage *)elem->data);
 
 		case MSIM_TYPE_RAW:
-			return msim_msg_dictionary_parse((gchar *)elem->data);
+			return msim_msg_dictionary_parse(elem->data);
 
 		default:
 			purple_debug_info("msim_msg_get_dictionary", "type %d unknown, name %s\n",