+/* charray.c - routines for dealing with char * arrays */
/* $OpenLDAP$ */
-/*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2012 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
*/
-/* charray.c - routines for dealing with char * arrays */
#include "portable.h"
int
ldap_charray_add(
char ***a,
- char *s
+ const char *s
)
{
int n;
int
ldap_charray_inlist(
char **a,
- char *s
+ const char *s
)
{
int i;
}
i = 1;
- for ( s = str; *s; s++ ) {
- if ( ldap_utf8_strchr( brkstr, s ) != NULL ) {
- i++;
- }
+ for ( s = str; ; LDAP_UTF8_INCR(s) ) {
+ s = ldap_utf8_strpbrk( s, brkstr );
+ if ( !s ) break;
+ i++;
}
res = (char **) LDAP_MALLOC( (i + 1) * sizeof(char *) );