There's no reason for these to not be const is there? This doesn't

Tue, 03 Feb 2009 18:56:17 +0000

author
Mark Doliner <markdoliner@pidgin.im>
date
Tue, 03 Feb 2009 18:56:17 +0000
changeset 25559
b8df546bf422
parent 25558
94aa46eb4604
child 25560
e5b8d2a10cba

There's no reason for these to not be const is there? This doesn't
break API compatibility in my mind. Does anyone think it does?

ChangeLog.API file | annotate | diff | comparison | revisions
libpurple/xmlnode.c file | annotate | diff | comparison | revisions
libpurple/xmlnode.h file | annotate | diff | comparison | revisions
--- a/ChangeLog.API	Tue Feb 03 18:53:04 2009 +0000
+++ b/ChangeLog.API	Tue Feb 03 18:56:17 2009 +0000
@@ -6,6 +6,8 @@
 		* purple_status_type_new now defaults "saveable" to TRUE.
 		  This was necessary in order to maintain the current behavior
 		  while fixing non-saveable statuses not to be saved.
+		* xmlnode_get_prefix, xmlnode_to_str and xmlnode_to_formatted_str
+		  now all take a const xmlnode* instead of an xmlnode*
 
 version 2.5.4 (01/12/2009):
 	perl:
--- a/libpurple/xmlnode.c	Tue Feb 03 18:53:04 2009 +0000
+++ b/libpurple/xmlnode.c	Tue Feb 03 18:56:17 2009 +0000
@@ -303,7 +303,7 @@
 	node->prefix = g_strdup(prefix);
 }
 
-const char *xmlnode_get_prefix(xmlnode *node)
+const char *xmlnode_get_prefix(const xmlnode *node)
 {
 	g_return_val_if_fail(node != NULL, NULL);
 	return node->prefix;
@@ -443,11 +443,11 @@
 }
 
 static char *
-xmlnode_to_str_helper(xmlnode *node, int *len, gboolean formatting, int depth)
+xmlnode_to_str_helper(const xmlnode *node, int *len, gboolean formatting, int depth)
 {
 	GString *text = g_string_new("");
 	const char *prefix;
-	xmlnode *c;
+	const xmlnode *c;
 	char *node_name, *esc, *esc2, *tab = NULL;
 	gboolean need_end = FALSE, pretty = formatting;
 
@@ -537,13 +537,13 @@
 }
 
 char *
-xmlnode_to_str(xmlnode *node, int *len)
+xmlnode_to_str(const xmlnode *node, int *len)
 {
 	return xmlnode_to_str_helper(node, len, FALSE, 0);
 }
 
 char *
-xmlnode_to_formatted_str(xmlnode *node, int *len)
+xmlnode_to_formatted_str(const xmlnode *node, int *len)
 {
 	char *xml, *xml_with_declaration;
 
--- a/libpurple/xmlnode.h	Tue Feb 03 18:53:04 2009 +0000
+++ b/libpurple/xmlnode.h	Tue Feb 03 18:56:17 2009 +0000
@@ -243,7 +243,7 @@
  * @param node The node to get the prefix from
  * @return The prefix of this node
  */
-const char *xmlnode_get_prefix(xmlnode *node);
+const char *xmlnode_get_prefix(const xmlnode *node);
 
 /**
  * Returns the node in a string of xml.
@@ -254,7 +254,7 @@
  * @return The node represented as a string.  You must
  *         g_free this string when finished using it.
  */
-char *xmlnode_to_str(xmlnode *node, int *len);
+char *xmlnode_to_str(const xmlnode *node, int *len);
 
 /**
  * Returns the node in a string of human readable xml.
@@ -266,7 +266,7 @@
  *         tab and new line characters.  You must
  *         g_free this string when finished using it.
  */
-char *xmlnode_to_formatted_str(xmlnode *node, int *len);
+char *xmlnode_to_formatted_str(const xmlnode *node, int *len);
 
 /**
  * Creates a node from a string of XML.  Calling this on the

mercurial