utf8ify_rfc822_string() is in libcitadel now
[citadel.git] / libcitadel / lib / vcard.c
index 5223da6b7c95a6b599808ce7d9cfeb7a0ac6d560..f52bb29c49f5ba14ac66b93734ee82545396eb05 100644 (file)
@@ -2,8 +2,9 @@
  * vCard implementation for Citadel
  *
  * Copyright (C) 1999-2008 by the citadel.org development team.
- * This code is freely redistributable under the terms of the GNU General
- * Public License.  All other rights reserved.
+ *
+// This program is open source software.  Use, duplication, or disclosure
+// is subject to the terms of the GNU General Public License, version 3.
  */
 
 
@@ -81,7 +82,7 @@ void remove_charset_attribute(char *strbuf)
  * propname    name of new property
  * propvalue   value of new property
  */
-void vcard_add_prop(struct vCard *v, char *propname, char *propvalue) {
+void vcard_add_prop(struct vCard *v, const char *propname, const char *propvalue) {
        ++v->numprops;
        v->prop = realloc(v->prop,
                (v->numprops * sizeof(struct vCardProp)) );
@@ -126,12 +127,14 @@ struct vCard *vcard_load(char *vtext) {
        }
 
        v = vcard_new();
-       if (v == NULL) return v;
+       if (v == NULL)
+       {
+               free(mycopy);
+               return v;
+       }
 
        ptr = mycopy;
        while (!IsEmptyStr(ptr)) {
-               colonpos = (-1);
-               nlpos = (-1);
                colonpos = pattern2(ptr, ":");
                nlpos = pattern2(ptr, "\n");