]> code.citadel.org Git - citadel.git/commitdiff
* Made a small API change to vcard.c for WebCit, brought the change over here too
authorArt Cancro <ajc@citadel.org>
Mon, 4 Mar 2002 05:29:39 +0000 (05:29 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 4 Mar 2002 05:29:39 +0000 (05:29 +0000)
  in order to keep vcard.c identical everywhere.

citadel/ChangeLog
citadel/vcard.c

index 691f46e38ebe36fa834b170a800da5d24982a3ba..b17807c3eed3e12b7d3ba59ff862db3c9d7a29f6 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 590.125  2002/03/04 05:29:39  ajc
+ * Made a small API change to vcard.c for WebCit, brought the change over here too
+   in order to keep vcard.c identical everywhere.
+
  Revision 590.124  2002/03/03 06:48:25  ajc
  * Client and server options to disable self-service user account creation
 
@@ -3383,4 +3387,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
-
index 9e7aeded4e6ac139cee07863c02d0be80627ed4e..03a16b689d196c5851ec29d8156131b4bbe772ad 100644 (file)
@@ -9,7 +9,6 @@
  */
 
 
-#include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <errno.h>
 #include <limits.h>
 #include <syslog.h>
-#include "citadel.h"
-#include "server.h"
-#include "control.h"
-#include "sysdep_decls.h"
-#include "support.h"
-#include "config.h"
-#include "tools.h"
+
+#include "webcit.h"
 #include "vcard.h"
 
 /* 
@@ -47,7 +41,7 @@
 struct vCard *vcard_new() {
        struct vCard *v;
 
-       v = (struct vCard *) mallok(sizeof(struct vCard));
+       v = (struct vCard *) malloc(sizeof(struct vCard));
        if (v == NULL) return v;
 
        v->magic = CTDL_VCARD_MAGIC;
@@ -69,7 +63,7 @@ struct vCard *vcard_load(char *vtext) {
        int i;
        int colonpos, nlpos;
 
-       mycopy = strdoop(vtext);
+       mycopy = strdup(vtext);
        if (mycopy == NULL) return NULL;
 
        /* First, fix this big pile o' vCard to make it more parseable.
@@ -96,8 +90,8 @@ struct vCard *vcard_load(char *vtext) {
                nlpos = pattern2(ptr, "\n");
 
                if (nlpos > colonpos > 0) {
-                       namebuf = mallok(colonpos + 1);
-                       valuebuf = mallok(nlpos - colonpos + 1);
+                       namebuf = malloc(colonpos + 1);
+                       valuebuf = malloc(nlpos - colonpos + 1);
                        strncpy(namebuf, ptr, colonpos);
                        namebuf[colonpos] = 0;
                        strncpy(valuebuf, &ptr[colonpos+1], nlpos-colonpos-1);
@@ -110,14 +104,14 @@ struct vCard *vcard_load(char *vtext) {
 
                        if ( (valid) && (strcasecmp(namebuf, "begin")) ) {
                                ++v->numprops;
-                               v->prop = reallok(v->prop,
+                               v->prop = realloc(v->prop,
                                        (v->numprops * sizeof(char *) * 2) );
                                v->prop[v->numprops-1].name = namebuf;
                                v->prop[v->numprops-1].value = valuebuf;
                        } 
                        else {
-                               phree(namebuf);
-                               phree(valuebuf);
+                               free(namebuf);
+                               free(valuebuf);
                        }
 
                }
@@ -128,7 +122,7 @@ struct vCard *vcard_load(char *vtext) {
                if (*ptr == '\n') ++ptr;
        }
 
-       phree(mycopy);
+       free(mycopy);
        return v;
 }
 
@@ -147,6 +141,7 @@ char *vcard_get_prop(struct vCard *v, char *propname,
 
        if (v->numprops) for (i=0; i<(v->numprops); ++i) {
                if ( (!strcasecmp(v->prop[i].name, propname))
+                  || (propname[0] == 0)
                   || (  (!strncasecmp(v->prop[i].name,
                                        propname, strlen(propname)))
                         && (v->prop[i].name[strlen(propname)] == ';')
@@ -172,14 +167,14 @@ void vcard_free(struct vCard *v) {
        if (v->magic != CTDL_VCARD_MAGIC) return;       /* Self-check */
        
        if (v->numprops) for (i=0; i<(v->numprops); ++i) {
-               phree(v->prop[i].name);
-               phree(v->prop[i].value);
+               free(v->prop[i].name);
+               free(v->prop[i].value);
        }
 
-       if (v->prop != NULL) phree(v->prop);
+       if (v->prop != NULL) free(v->prop);
        
        memset(v, 0, sizeof(struct vCard));
-       phree(v);
+       free(v);
 }
 
 
@@ -196,20 +191,20 @@ void vcard_set_prop(struct vCard *v, char *name, char *value, int append) {
        /* If this key is already present, replace it */
        if (!append) if (v->numprops) for (i=0; i<(v->numprops); ++i) {
                if (!strcasecmp(v->prop[i].name, name)) {
-                       phree(v->prop[i].name);
-                       phree(v->prop[i].value);
-                       v->prop[i].name = strdoop(name);
-                       v->prop[i].value = strdoop(value);
+                       free(v->prop[i].name);
+                       free(v->prop[i].value);
+                       v->prop[i].name = strdup(name);
+                       v->prop[i].value = strdup(value);
                        return;
                }
        }
 
        /* Otherwise, append it */
        ++v->numprops;
-       v->prop = reallok(v->prop,
+       v->prop = realloc(v->prop,
                (v->numprops * sizeof(char *) * 2) );
-       v->prop[v->numprops-1].name = strdoop(name);
-       v->prop[v->numprops-1].value = strdoop(value);
+       v->prop[v->numprops-1].name = strdup(name);
+       v->prop[v->numprops-1].value = strdup(value);
 }
 
 
@@ -235,7 +230,7 @@ char *vcard_serialize(struct vCard *v)
                        strlen(v->prop[i].value) + 4;
        }
 
-       ser = mallok(len);
+       ser = malloc(len);
        if (ser == NULL) return NULL;
 
        strcpy(ser, "begin:vcard\r\n");