ldb_tdb: Move constants into ldb_tdb.h
authorAndrew Bartlett <abartlet@samba.org>
Fri, 1 Sep 2017 08:04:43 +0000 (20:04 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 22 Sep 2017 19:20:24 +0000 (21:20 +0200)
This helps ensure we keep these all in sync.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
lib/ldb/ldb_tdb/ldb_index.c

index f99fb985a4d9f9532f43fba4987142dad69899b0..3ba0a949da1f032c8f7228ad086bee0c61be9ac7 100644 (file)
@@ -291,7 +291,6 @@ normal_index:
                list->count = el->num_values;
        } else {
                unsigned int i;
-               static const size_t GUID_val_size = 16;
                if (version != LTDB_GUID_INDEXING_VERSION) {
                        /* This is quite likely during the DB startup
                           on first upgrade to using a GUID index */
@@ -308,11 +307,11 @@ normal_index:
                        return LDB_ERR_OPERATIONS_ERROR;
                }
 
-               if ((el->values[0].length % GUID_val_size) != 0) {
+               if ((el->values[0].length % LTDB_GUID_SIZE) != 0) {
                        return LDB_ERR_OPERATIONS_ERROR;
                }
 
-               list->count = el->values[0].length / GUID_val_size;
+               list->count = el->values[0].length / LTDB_GUID_SIZE;
                list->dn = talloc_array(list, struct ldb_val, list->count);
 
                /*
@@ -321,8 +320,9 @@ normal_index:
                 */
                talloc_steal(list->dn, msg);
                for (i = 0; i < list->count; i++) {
-                       list->dn[i].data = &el->values[0].data[i * GUID_val_size];
-                       list->dn[i].length = GUID_val_size;
+                       list->dn[i].data
+                               = &el->values[0].data[i * LTDB_GUID_SIZE];
+                       list->dn[i].length = LTDB_GUID_SIZE;
                }
        }