]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Slightly beautify internal_resolve_name()
authorVolker Lendecke <vl@samba.org>
Tue, 24 Nov 2020 20:22:55 +0000 (21:22 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 30 Nov 2020 22:24:38 +0000 (22:24 +0000)
We have "goto done;" at the end of every if-branch, we don't need
else.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/namequery.c

index 7b7a6bc4d507537d9da5d1f34948b893cd879deb..d4ccafaec08aeb352c970472a6a2d9d171c337bb 100644 (file)
@@ -3269,7 +3269,7 @@ NTSTATUS internal_resolve_name(TALLOC_CTX *ctx,
        for (i=0; resolve_order[i]; i++) {
                const char *tok = resolve_order[i];
 
-               if((strequal(tok, "host") || strequal(tok, "hosts"))) {
+               if ((strequal(tok, "host") || strequal(tok, "hosts"))) {
                        status = resolve_hosts(talloc_tos(),
                                               name,
                                               name_type,
@@ -3279,7 +3279,9 @@ NTSTATUS internal_resolve_name(TALLOC_CTX *ctx,
                                continue;
                        }
                        goto done;
-               } else if(strequal( tok, "kdc")) {
+               }
+
+               if (strequal(tok, "kdc")) {
                        /* deal with KDC_NAME_TYPE names here.
                         * This will result in a SRV record lookup */
                        status = resolve_ads(talloc_tos(),
@@ -3295,7 +3297,9 @@ NTSTATUS internal_resolve_name(TALLOC_CTX *ctx,
                         * this with the KDC port. */
                        name_type = KDC_NAME_TYPE;
                        goto done;
-               } else if(strequal( tok, "ads")) {
+               }
+
+               if (strequal(tok, "ads")) {
                        /* deal with 0x1c and 0x1b names here.
                         * This will result in a SRV record lookup */
                        status = resolve_ads(talloc_tos(),
@@ -3308,7 +3312,9 @@ NTSTATUS internal_resolve_name(TALLOC_CTX *ctx,
                                continue;
                        }
                        goto done;
-               } else if (strequal(tok, "lmhosts")) {
+               }
+
+               if (strequal(tok, "lmhosts")) {
                        status = resolve_lmhosts_file_as_sockaddr(
                                talloc_tos(),
                                get_dyn_LMHOSTSFILE(),
@@ -3320,7 +3326,9 @@ NTSTATUS internal_resolve_name(TALLOC_CTX *ctx,
                                continue;
                        }
                        goto done;
-               } else if (strequal(tok, "wins")) {
+               }
+
+               if (strequal(tok, "wins")) {
                        /* don't resolve 1D via WINS */
                        if (name_type == 0x1D) {
                                continue;
@@ -3334,7 +3342,9 @@ NTSTATUS internal_resolve_name(TALLOC_CTX *ctx,
                                continue;
                        }
                        goto done;
-               } else if (strequal(tok, "bcast")) {
+               }
+
+               if (strequal(tok, "bcast")) {
                        status = name_resolve_bcast(
                                                talloc_tos(),
                                                name,
@@ -3345,10 +3355,9 @@ NTSTATUS internal_resolve_name(TALLOC_CTX *ctx,
                                continue;
                        }
                        goto done;
-               } else {
-                       DBG_ERR("unknown name switch type %s\n",
-                               tok);
                }
+
+               DBG_ERR("unknown name switch type %s\n", tok);
        }
 
        /* All of the resolve_* functions above have returned false. */