mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-23 08:09:34 -05:00
Moved bdb_strcopy to slap_strcopy
This commit is contained in:
parent
dae9473e08
commit
2a3dc7ab8f
3 changed files with 20 additions and 19 deletions
|
|
@ -430,22 +430,6 @@ typedef struct idNode {
|
||||||
ldap_pvt_thread_rdwr_t i_kids_rdwr;
|
ldap_pvt_thread_rdwr_t i_kids_rdwr;
|
||||||
} idNode;
|
} 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
|
/* 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
|
* sorted in lexical order. These are the various helper routines used
|
||||||
|
|
@ -630,9 +614,9 @@ int bdb_fix_dn(
|
||||||
ptr = e->e_dn;
|
ptr = e->e_dn;
|
||||||
nptr = e->e_ndn;
|
nptr = e->e_ndn;
|
||||||
for (n = o; n; n=n->i_parent) {
|
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++ = ',';
|
*ptr++ = ',';
|
||||||
nptr = bdb_strcopy(nptr, n->i_rdn->nrdn.bv_val);
|
nptr = slap_strcopy(nptr, n->i_rdn->nrdn.bv_val);
|
||||||
*nptr++ = ',';
|
*nptr++ = ',';
|
||||||
}
|
}
|
||||||
ldap_pvt_thread_rdwr_runlock(&bdb->bi_tree_rdwr);
|
ldap_pvt_thread_rdwr_runlock(&bdb->bi_tree_rdwr);
|
||||||
|
|
@ -800,7 +784,7 @@ bdb_dn2id_matched(
|
||||||
ptr = ch_malloc(len);
|
ptr = ch_malloc(len);
|
||||||
*matchedDN = ptr;
|
*matchedDN = ptr;
|
||||||
for (;rdns[i]; i++) {
|
for (;rdns[i]; i++) {
|
||||||
ptr = bdb_strcopy(ptr, rdns[i]);
|
ptr = slap_strcopy(ptr, rdns[i]);
|
||||||
*ptr++ = ',';
|
*ptr++ = ',';
|
||||||
}
|
}
|
||||||
ptr[-1] = '\0';
|
ptr[-1] = '\0';
|
||||||
|
|
|
||||||
|
|
@ -279,3 +279,19 @@ charray_strcasecmp( const char **a1, const char **a2 )
|
||||||
return 0;
|
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;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 (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_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 (int) charray_strcasecmp LDAP_P(( const char **a1, const char **a2 ));
|
||||||
|
LDAP_SLAPD_F (char *) slap_strcopy LDAP_P(( char *a1, char *a2 ));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue