ldb: Introduce "colon" variable in ldb_module_connect_backend()
authorVolker Lendecke <vl@samba.org>
Sat, 9 Apr 2022 06:15:54 +0000 (08:15 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 26 Apr 2022 21:41:29 +0000 (21:41 +0000)
Easier debugging, avoid a second call to strchr()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/ldb/common/ldb_modules.c

index 4366f05e066c53c203fe9909e707cfeb6d16b0ce..2d0494a2123e49d437aa39c77b416cda77f2e1ae 100644 (file)
@@ -197,9 +197,11 @@ int ldb_module_connect_backend(struct ldb_context *ldb,
        int ret;
        char *backend;
        struct backends_list_entry *be;
+       char *colon = NULL;
 
-       if (strchr(url, ':') != NULL) {
-               backend = talloc_strndup(ldb, url, strchr(url, ':')-url);
+       colon = strchr(url, ':');
+       if (colon != NULL) {
+               backend = talloc_strndup(ldb, url, colon-url);
        } else {
                /* Default to tdb */
                backend = talloc_strdup(ldb, "tdb");