Moved bdb_strcopy to slap_strcopy

This commit is contained in:
Howard Chu 2001-12-26 15:52:46 +00:00
parent dae9473e08
commit 2a3dc7ab8f
3 changed files with 20 additions and 19 deletions

View file

@ -430,22 +430,6 @@ typedef struct idNode {
ldap_pvt_thread_rdwr_t i_kids_rdwr;
} idNode;
/* strcopy is like strcpy except it returns a pointer to the trailing NUL of
* the result string. This allows fast construction of catenated strings
* without the overhead of strlen/strcat.
*/
char *
bdb_strcopy(
char *a,
char *b
)
{
if (!a || !b)
return a;
while (*a++ = *b++) ;
return a-1;
}
/* The main AVL tree is sorted in ID order. The i_kids AVL trees are
* sorted in lexical order. These are the various helper routines used
@ -630,9 +614,9 @@ int bdb_fix_dn(
ptr = e->e_dn;
nptr = e->e_ndn;
for (n = o; n; n=n->i_parent) {
ptr = bdb_strcopy(ptr, n->i_rdn->rdn.bv_val);
ptr = slap_strcopy(ptr, n->i_rdn->rdn.bv_val);
*ptr++ = ',';
nptr = bdb_strcopy(nptr, n->i_rdn->nrdn.bv_val);
nptr = slap_strcopy(nptr, n->i_rdn->nrdn.bv_val);
*nptr++ = ',';
}
ldap_pvt_thread_rdwr_runlock(&bdb->bi_tree_rdwr);
@ -800,7 +784,7 @@ bdb_dn2id_matched(
ptr = ch_malloc(len);
*matchedDN = ptr;
for (;rdns[i]; i++) {
ptr = bdb_strcopy(ptr, rdns[i]);
ptr = slap_strcopy(ptr, rdns[i]);
*ptr++ = ',';
}
ptr[-1] = '\0';

View file

@ -279,3 +279,19 @@ charray_strcasecmp( const char **a1, const char **a2 )
return 0;
}
/* strcopy is like strcpy except it returns a pointer to the trailing NUL of
* the result string. This allows fast construction of catenated strings
* without the overhead of strlen/strcat.
*/
char *
slap_strcopy(
char *a,
char *b
)
{
if (!a || !b)
return a;
while (*a++ = *b++) ;
return a-1;
}

View file

@ -274,6 +274,7 @@ LDAP_SLAPD_F (char **) str2charray LDAP_P(( const char *str, const char *brkstr
LDAP_SLAPD_F (struct berval **) str2bvec LDAP_P(( struct berval **vec, const char *str, const char *brkstr ));
LDAP_SLAPD_F (int) charray_strcmp LDAP_P(( const char **a1, const char **a2 ));
LDAP_SLAPD_F (int) charray_strcasecmp LDAP_P(( const char **a1, const char **a2 ));
LDAP_SLAPD_F (char *) slap_strcopy LDAP_P(( char *a1, char *a2 ));
/*