]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/charray.c
need this outside for back monitor ...
[openldap] / servers / slapd / charray.c
index 4c61238b3a57572266102aad2b5914442b913f3b..2b628d7bbb5e63b7e281bbb4b24feb0a60d455ca 100644 (file)
@@ -1,7 +1,7 @@
 /* charray.c - routines for dealing with char * arrays */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
@@ -229,7 +229,11 @@ slap_strcopy(
        return a-1;
 }
 
-void
+/* Unlike charray_add, bvarray_add does not make a new copy of the
+ * source string. Typically it is used where ber_bvecadd was before,
+ * and ber_bvecadd didn't duplicate its source either.
+ */
+int
 bvarray_add(
     struct berval **a,
     struct berval *bv
@@ -248,10 +252,12 @@ bvarray_add(
                *a = (struct berval *) ch_realloc( (char *) *a,
                    (n + 2) * sizeof(struct berval) );
        }
+       if ( *a == NULL ) return -1;
 
-       ber_dupbv( (*a)+n, bv );
-       n++;
+       (*a)[n++] = *bv;
        (*a)[n].bv_val = NULL;
+
+       return 0;
 }
 
 void