From 4f5502ef9fe3b3a032a7d6371510397d500ad293 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Wed, 17 Aug 2005 07:50:28 +0000 Subject: [PATCH] rework internal functions - need the parsed list of URIs before massaging; no impact on exposed funcs --- libraries/libldap/url.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/libraries/libldap/url.c b/libraries/libldap/url.c index 2c1be570f6..ecfb3808b1 100644 --- a/libraries/libldap/url.c +++ b/libraries/libldap/url.c @@ -1228,14 +1228,9 @@ ldap_url_duplist (LDAPURLDesc *ludlist) return dest; } -int -ldap_url_parselist (LDAPURLDesc **ludlist, const char *url ) -{ - return ldap_url_parselist_ext( ludlist, url, ", " ); -} - -int -ldap_url_parselist_ext (LDAPURLDesc **ludlist, const char *url, const char *sep ) +static int +ldap_url_parselist_int (LDAPURLDesc **ludlist, const char *url, const char *sep, + int (*url_parse)( const char *, LDAPURLDesc ** ) ) { int i, rc; LDAPURLDesc *ludp; @@ -1254,7 +1249,7 @@ ldap_url_parselist_ext (LDAPURLDesc **ludlist, const char *url, const char *sep for (i = 0; urls[i] != NULL; i++) ; /* ...and put them in the "stack" backward */ while (--i >= 0) { - rc = ldap_url_parse( urls[i], &ludp ); + rc = url_parse( urls[i], &ludp ); if ( rc != 0 ) { ldap_charray_free(urls); ldap_free_urllist(*ludlist); @@ -1268,6 +1263,18 @@ ldap_url_parselist_ext (LDAPURLDesc **ludlist, const char *url, const char *sep return LDAP_URL_SUCCESS; } +int +ldap_url_parselist (LDAPURLDesc **ludlist, const char *url ) +{ + return ldap_url_parselist_int( ludlist, url, ", ", ldap_url_parse ); +} + +int +ldap_url_parselist_ext (LDAPURLDesc **ludlist, const char *url, const char *sep ) +{ + return ldap_url_parselist_int( ludlist, url, sep, ldap_url_parse_ext ); +} + int ldap_url_parsehosts( LDAPURLDesc **ludlist,