From 2a3dc7ab8feae3c44ac92d2b1caf6bf86abd56ac Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 26 Dec 2001 15:52:46 +0000 Subject: [PATCH] Moved bdb_strcopy to slap_strcopy --- servers/slapd/back-bdb/dn2id.c | 22 +++------------------- servers/slapd/charray.c | 16 ++++++++++++++++ servers/slapd/proto-slap.h | 1 + 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index b1e8f071dc..a2d6883929 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -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'; diff --git a/servers/slapd/charray.c b/servers/slapd/charray.c index 06276dedee..9476616c12 100644 --- a/servers/slapd/charray.c +++ b/servers/slapd/charray.c @@ -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; +} diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 127917ccd3..6e76c3e3b0 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -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 )); /* -- 2.39.5