summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2009-09-27 16:45:57 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2009-09-27 16:45:57 +0200
commitc580cb90e7df9a2438247b68b60577fa335896b0 (patch)
treebf44ce5d4538b2dc7305e0dd267412886a2edd14 /common
parent3f00b600386edefcc93191a974430b7de5429ebd (diff)
downloadeurephia-c580cb90e7df9a2438247b68b60577fa335896b0.tar.gz
eurephia-c580cb90e7df9a2438247b68b60577fa335896b0.tar.xz
eurephia-c580cb90e7df9a2438247b68b60577fa335896b0.zip
Code clean up. Moved xmlReplaceChars() to eurephia_xml.c
Diffstat (limited to 'common')
-rw-r--r--common/eurephia_xml.c21
-rw-r--r--common/eurephia_xml.h2
2 files changed, 23 insertions, 0 deletions
diff --git a/common/eurephia_xml.c b/common/eurephia_xml.c
index d47ef85..dec397f 100644
--- a/common/eurephia_xml.c
+++ b/common/eurephia_xml.c
@@ -43,6 +43,27 @@
/**
+ * String replace in a xmlChar based string
+ *
+ * @param str xmlChar input string
+ * @param s search for this character
+ * @param r replace the character with this one
+ */
+void xmlReplaceChars(xmlChar *str, char s, char r) {
+ if( str != NULL ) {
+ xmlChar *ptr = str;
+
+ while( *ptr != '\0' ) {
+ if( *ptr == s ) {
+ *ptr = r;
+ }
+ ptr++;
+ }
+ }
+}
+
+
+/**
* Retrieves a given XML node attribute/property
*
* @param attr xmlAttr pointer from an xmlNode pointer.
diff --git a/common/eurephia_xml.h b/common/eurephia_xml.h
index 2ee1175..083a881 100644
--- a/common/eurephia_xml.h
+++ b/common/eurephia_xml.h
@@ -62,6 +62,8 @@ typedef struct _eurephiaRESULT {
*/
#define foreach_xmlnode(start, itn) for( itn = start; itn != NULL; itn = itn->next )
+void xmlReplaceChars(xmlChar *str, char s, char r);
+
char *xmlGetAttrValue(xmlAttr *properties, const char *key);
xmlNode *xmlFindNode(xmlNode *node, const char *key);