]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/dnssrv.c
VLV clean
[openldap] / libraries / libldap / dnssrv.c
index ae963012a5f7c263e7dd634de0d7f44a022ff01c..cc193e93582bef587dcfb15c511b60feaf00d18d 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
@@ -41,9 +41,8 @@ int ldap_dn2domain(
        char *domain = NULL;
        char **dn;
 
-       if( dn_in == NULL || domainp == NULL ) {
-               return -1;
-       }
+       assert( dn_in != NULL );
+       assert( domainp != NULL );
 
        dn = ldap_explode_dn( dn_in, 0 );
 
@@ -147,12 +146,12 @@ int ldap_domain2dn(
     char *domain, *s, *tok_r, *dn;
     size_t loc;
 
-    if (domain_in == NULL || dnp == NULL) {
-       return LDAP_NO_MEMORY;
-    }
+       assert( domain_in != NULL );
+       assert( dnp != NULL );
+
     domain = LDAP_STRDUP(domain_in);
     if (domain == NULL) {
-       return LDAP_NO_MEMORY;
+               return LDAP_NO_MEMORY;
     }
     dn = NULL;
     loc = 0;
@@ -196,23 +195,20 @@ int ldap_domain2hostlist(
 {
 #ifdef HAVE_RES_QUERY
     char *request;
-    char *dn;
     char *hostlist = NULL;
     int rc, len, cur = 0;
     unsigned char reply[1024];
 
-       if( domain == NULL || *domain == '\0' ) {
-               return LDAP_PARAM_ERROR;
-       }
+       assert( domain != NULL );
+       assert( list != NULL );
 
-       if( list == NULL ) {
+       if( *domain == '\0' ) {
                return LDAP_PARAM_ERROR;
        }
 
     request = LDAP_MALLOC(strlen(domain) + sizeof("_ldap._tcp."));
     if (request == NULL) {
-       rc = LDAP_NO_MEMORY;
-       goto out;
+               return LDAP_NO_MEMORY;
     }
     sprintf(request, "_ldap._tcp.%s", domain);