ldb_tdb index: fix whitespace
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 20 Jul 2016 01:35:58 +0000 (13:35 +1200)
committerStefan Metzmacher <metze@samba.org>
Thu, 28 Jul 2016 08:06:12 +0000 (10:06 +0200)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/ldb_tdb/ldb_index.c

index 5383653a0f965b8ab4d9a1cc0aa835442f27f426..03ad44a1757f814c454f3933b884810011a8a2a5 100644 (file)
@@ -105,7 +105,7 @@ static struct dn_list *ltdb_index_idxptr(struct ldb_module *module, TDB_DATA rec
 {
        struct dn_list *list;
        if (rec.dsize != sizeof(void *)) {
-               ldb_asprintf_errstring(ldb_module_get_ctx(module), 
+               ldb_asprintf_errstring(ldb_module_get_ctx(module),
                                       "Bad data size for idxptr %u", (unsigned)rec.dsize);
                return NULL;
        }
@@ -115,14 +115,14 @@ static struct dn_list *ltdb_index_idxptr(struct ldb_module *module, TDB_DATA rec
        memcpy(&list, rec.dptr, sizeof(void *));
        list = talloc_get_type(list, struct dn_list);
        if (list == NULL) {
-               ldb_asprintf_errstring(ldb_module_get_ctx(module), 
-                                      "Bad type '%s' for idxptr", 
+               ldb_asprintf_errstring(ldb_module_get_ctx(module),
+                                      "Bad type '%s' for idxptr",
                                       talloc_get_name(list));
                return NULL;
        }
        if (check_parent && list->dn && talloc_parent(list->dn) != list) {
-               ldb_asprintf_errstring(ldb_module_get_ctx(module), 
-                                      "Bad parent '%s' for idxptr", 
+               ldb_asprintf_errstring(ldb_module_get_ctx(module),
+                                      "Bad parent '%s' for idxptr",
                                       talloc_get_name(talloc_parent(list->dn)));
                return NULL;
        }
@@ -130,7 +130,7 @@ static struct dn_list *ltdb_index_idxptr(struct ldb_module *module, TDB_DATA rec
 }
 
 /*
-  return the @IDX list in an index entry for a dn as a 
+  return the @IDX list in an index entry for a dn as a
   struct dn_list
  */
 static int ltdb_dn_list_load(struct ldb_module *module,
@@ -203,7 +203,7 @@ normal_index:
 /*
   save a dn_list into a full @IDX style record
  */
-static int ltdb_dn_list_store_full(struct ldb_module *module, struct ldb_dn *dn, 
+static int ltdb_dn_list_store_full(struct ldb_module *module, struct ldb_dn *dn,
                                   struct dn_list *list)
 {
        struct ldb_message *msg;
@@ -249,7 +249,7 @@ static int ltdb_dn_list_store_full(struct ldb_module *module, struct ldb_dn *dn,
 /*
   save a dn_list into the database, in either @IDX or internal format
  */
-static int ltdb_dn_list_store(struct ldb_module *module, struct ldb_dn *dn, 
+static int ltdb_dn_list_store(struct ldb_module *module, struct ldb_dn *dn,
                              struct dn_list *list)
 {
        struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), struct ltdb_private);
@@ -404,7 +404,7 @@ static struct ldb_dn *ltdb_index_key(struct ldb_context *ldb,
        r = a->syntax->canonicalise_fn(ldb, ldb, value, &v);
        if (r != LDB_SUCCESS) {
                const char *errstr = ldb_errstring(ldb);
-               /* canonicalisation can be refused. For example, 
+               /* canonicalisation can be refused. For example,
                   a attribute that takes wildcards will refuse to canonicalise
                   if the value contains a wildcard */
                ldb_asprintf_errstring(ldb, "Failed to create index key for attribute '%s':%s%s%s",
@@ -490,7 +490,7 @@ static int ltdb_index_dn_simple(struct ldb_module *module,
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
-       /* the attribute is indexed. Pull the list of DNs that match the 
+       /* the attribute is indexed. Pull the list of DNs that match the
           search criterion */
        dn = ltdb_index_key(ldb, tree->u.equality.attr, &tree->u.equality.value, NULL);
        if (!dn) return LDB_ERR_OPERATIONS_ERROR;
@@ -760,7 +760,7 @@ static int ltdb_index_dn_and(struct ldb_module *module,
                    !ltdb_index_unique(ldb, subtree->u.equality.attr)) {
                        continue;
                }
-               
+
                ret = ltdb_index_dn(module, subtree, index_list, list);
                if (ret == LDB_ERR_NO_SUCH_OBJECT) {
                        /* 0 && X == 0 */
@@ -773,7 +773,7 @@ static int ltdb_index_dn_and(struct ldb_module *module,
                         * filtering */
                        return LDB_SUCCESS;
                }
-       }       
+       }
 
        /* now do a full intersection */
        found = false;
@@ -787,7 +787,7 @@ static int ltdb_index_dn_and(struct ldb_module *module,
                if (list2 == NULL) {
                        return ldb_module_oom(module);
                }
-                       
+
                ret = ltdb_index_dn(module, subtree, index_list, list2);
 
                if (ret == LDB_ERR_NO_SUCH_OBJECT) {
@@ -797,7 +797,7 @@ static int ltdb_index_dn_and(struct ldb_module *module,
                        talloc_free(list2);
                        return LDB_ERR_NO_SUCH_OBJECT;
                }
-               
+
                if (ret != LDB_SUCCESS) {
                        /* this didn't adding anything */
                        talloc_free(list2);
@@ -813,17 +813,17 @@ static int ltdb_index_dn_and(struct ldb_module *module,
                        talloc_free(list2);
                        return LDB_ERR_OPERATIONS_ERROR;
                }
-                       
+
                if (list->count == 0) {
                        list->dn = NULL;
                        return LDB_ERR_NO_SUCH_OBJECT;
                }
-                       
+
                if (list->count < 2) {
                        /* it isn't worth loading the next part of the tree */
                        return LDB_SUCCESS;
                }
-       }       
+       }
 
        if (!found) {
                /* none of the attributes were indexed */
@@ -832,7 +832,7 @@ static int ltdb_index_dn_and(struct ldb_module *module,
 
        return LDB_SUCCESS;
 }
-       
+
 /*
   return a list of matching objects using a one-level index
  */
@@ -916,7 +916,7 @@ static int ltdb_index_dn(struct ldb_module *module,
   extracting just the given attributes
 */
 static int ltdb_index_filter(const struct dn_list *dn_list,
-                            struct ltdb_context *ac, 
+                            struct ltdb_context *ac,
                             uint32_t *match_count)
 {
        struct ldb_context *ldb;
@@ -1011,7 +1011,7 @@ static void ltdb_dn_list_remove_duplicates(struct dn_list *list)
                        new_count++;
                }
        }
-       
+
        list->count = new_count;
 }
 
@@ -1027,7 +1027,7 @@ int ltdb_search_indexed(struct ltdb_context *ac, uint32_t *match_count)
        int ret;
 
        /* see if indexing is enabled */
-       if (!ltdb->cache->attribute_indexes && 
+       if (!ltdb->cache->attribute_indexes &&
            !ltdb->cache->one_level_indexes &&
            ac->scope != LDB_SCOPE_BASE) {
                /* fallback to a full search */
@@ -1053,7 +1053,7 @@ int ltdb_search_indexed(struct ltdb_context *ac, uint32_t *match_count)
                }
                dn_list->dn[0].length = strlen((char *)dn_list->dn[0].data);
                dn_list->count = 1;
-               break;          
+               break;
 
        case LDB_SCOPE_ONELEVEL:
                if (!ltdb->cache->one_level_indexes) {
@@ -1143,7 +1143,7 @@ static int ltdb_index_add1(struct ldb_module *module, const char *dn,
                talloc_free(list);
                ldb_asprintf_errstring(ldb, __location__ ": unique index violation on %s in %s",
                                       el->name, dn);
-               return LDB_ERR_ENTRY_ALREADY_EXISTS;            
+               return LDB_ERR_ENTRY_ALREADY_EXISTS;
        }
 
        /* If we are doing an ADD, then this can not already be in the index,
@@ -1157,7 +1157,7 @@ static int ltdb_index_add1(struct ldb_module *module, const char *dn,
        }
 
        /* overallocate the list a bit, to reduce the number of
-        * realloc trigered copies */    
+        * realloc trigered copies */
        alloc_len = ((list->count+1)+7) & ~7;
        list->dn = talloc_realloc(list, list->dn, struct ldb_val, alloc_len);
        if (list->dn == NULL) {
@@ -1284,7 +1284,7 @@ static int ltdb_index_onelevel(struct ldb_module *module, const struct ldb_messa
   add the index entries for a new element in a record
   The caller guarantees that these element values are not yet indexed
 */
-int ltdb_index_add_element(struct ldb_module *module, struct ldb_dn *dn, 
+int ltdb_index_add_element(struct ldb_module *module, struct ldb_dn *dn,
                           struct ldb_message_element *el)
 {
        struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), struct ltdb_private);
@@ -1376,7 +1376,7 @@ int ltdb_index_del_value(struct ldb_module *module, struct ldb_dn *dn,
        if (i == -1) {
                /* nothing to delete */
                talloc_free(dn_key);
-               return LDB_SUCCESS;             
+               return LDB_SUCCESS;
        }
 
        j = (unsigned int) i;
@@ -1495,7 +1495,7 @@ static int delete_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, vo
        dn = ldb_dn_from_ldb_val(ltdb, ldb_module_get_ctx(module), &v);
        ret = ltdb_dn_list_store(module, dn, &list);
        if (ret != LDB_SUCCESS) {
-               ldb_asprintf_errstring(ldb_module_get_ctx(module), 
+               ldb_asprintf_errstring(ldb_module_get_ctx(module),
                                       "Unable to store null index for %s\n",
                                                ldb_dn_get_linearized(dn));
                talloc_free(dn);