Cosmetic corrections for the LDB library
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Tue, 9 Sep 2008 15:36:52 +0000 (17:36 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 24 Sep 2008 17:40:03 +0000 (19:40 +0200)
This commit applies some cosmetic corrections for the LDB library.

source4/lib/ldb/common/attrib_handlers.c
source4/lib/ldb/common/ldb_attributes.c
source4/lib/ldb/common/ldb_debug.c
source4/lib/ldb/common/ldb_ldif.c
source4/lib/ldb/common/ldb_modules.c
source4/lib/ldb/modules/operational.c
source4/lib/ldb/modules/paged_results.c
source4/lib/ldb/modules/skel.c

index fb57e2dadc084fb74bf06d1dc7a9b1bc5fca42de..6f1b0815d7c7d2e914e42581f8e9b69de8e1f384 100644 (file)
@@ -38,9 +38,9 @@ int ldb_handler_copy(struct ldb_context *ldb, void *mem_ctx,
        *out = ldb_val_dup(mem_ctx, in);
        if (in->length > 0 && out->data == NULL) {
                ldb_oom(ldb);
-               return -1;
+               return LDB_ERR_OPERATIONS_ERROR;
        }
-       return 0;
+       return LDB_SUCCESS;
 }
 
 /*
@@ -57,13 +57,13 @@ int ldb_handler_fold(struct ldb_context *ldb, void *mem_ctx,
        int l;
 
        if (!in || !out || !(in->data)) {
-               return -1;
+               return LDB_ERR_OPERATIONS_ERROR;
        }
 
        out->data = (uint8_t *)ldb_casefold(ldb, mem_ctx, (const char *)(in->data), in->length);
        if (out->data == NULL) {
                ldb_debug(ldb, LDB_DEBUG_ERROR, "ldb_handler_fold: unable to casefold string [%s]", in->data);
-               return -1;
+               return LDB_ERR_OPERATIONS_ERROR;
        }
 
        s = (char *)(out->data);
@@ -96,7 +96,7 @@ int ldb_handler_fold(struct ldb_context *ldb, void *mem_ctx,
        }
 
        out->length = strlen((char *)out->data);
-       return 0;
+       return LDB_SUCCESS;
 }
 
 
@@ -111,14 +111,14 @@ int ldb_canonicalise_Integer(struct ldb_context *ldb, void *mem_ctx,
        char *end;
        long long i = strtoll((char *)in->data, &end, 0);
        if (*end != 0) {
-               return -1;
+               return LDB_ERR_OPERATIONS_ERROR;
        }
        out->data = (uint8_t *)talloc_asprintf(mem_ctx, "%lld", i);
        if (out->data == NULL) {
-               return -1;
+               return LDB_ERR_OPERATIONS_ERROR;
        }
        out->length = strlen((char *)out->data);
-       return 0;
+       return LDB_SUCCESS;
 }
 
 /*
@@ -251,7 +251,7 @@ int ldb_canonicalise_dn(struct ldb_context *ldb, void *mem_ctx,
        }
        out->length = strlen((char *)out->data);
 
-       ret = 0;
+       ret = LDB_SUCCESS;
 
 done:
        talloc_free(dn);
@@ -305,10 +305,10 @@ int ldb_canonicalise_utctime(struct ldb_context *ldb, void *mem_ctx,
        time_t t = ldb_string_to_time((char *)in->data);
        out->data = (uint8_t *)ldb_timestring(mem_ctx, t);
        if (out->data == NULL) {
-               return -1;
+               return LDB_ERR_OPERATIONS_ERROR;
        }
        out->length = strlen((char *)out->data);
-       return 0;
+       return LDB_SUCCESS;
 }
 
 /*
index 747f2417811a9069b1ed4391b70672b6d54f590b..0fbb5e2bfb49cebd45a60ffaf3f667f808fa299c 100644 (file)
@@ -61,7 +61,7 @@ int ldb_schema_attribute_add_with_syntax(struct ldb_context *ldb,
                           struct ldb_schema_attribute, n);
        if (a == NULL) {
                ldb_oom(ldb);
-               return -1;
+               return LDB_ERR_OPERATIONS_ERROR;
        }
        ldb->schema.attributes = a;
 
@@ -70,7 +70,7 @@ int ldb_schema_attribute_add_with_syntax(struct ldb_context *ldb,
                if (cmp == 0) {
                        /* silently ignore attempts to overwrite fixed attributes */
                        if (a[i].flags & LDB_ATTR_FLAG_FIXED) {
-                               return 0;
+                               return LDB_SUCCESS;
                        }
                        if (a[i].flags & LDB_ATTR_FLAG_ALLOCATED) {
                                talloc_free(discard_const_p(char, a[i].name));
@@ -93,11 +93,11 @@ int ldb_schema_attribute_add_with_syntax(struct ldb_context *ldb,
                a[i].name = talloc_strdup(a, a[i].name);
                if (a[i].name == NULL) {
                        ldb_oom(ldb);
-                       return -1;
+                       return LDB_ERR_OPERATIONS_ERROR;
                }
        }
 
-       return 0;
+       return LDB_SUCCESS;
 }
 
 static const struct ldb_schema_syntax ldb_syntax_default = {
index 0f78e37c1c570ae91ed13a3fca6c9c5dcb78419d..8e1c491f1275b6da56c6f9f7179754af0f6fc732 100644 (file)
@@ -43,7 +43,7 @@ int ldb_set_debug(struct ldb_context *ldb,
 {
        ldb->debug_ops.debug = debug;
        ldb->debug_ops.context = context;
-       return 0;
+       return LDB_SUCCESS;
 }
 
 /*
index fb93e17c6c04dc45a69e103d254c0aac07f82f14..6cbd30f377a65a0afdda15ac7b5a944f30a0c51c 100644 (file)
@@ -191,19 +191,19 @@ int ldb_should_b64_encode(const struct ldb_val *val)
        uint8_t *p = val->data;
 
        if (val->length == 0) {
-               return 0;
+               return LDB_SUCCESS;
        }
 
        if (p[0] == ' ' || p[0] == ':') {
-               return 1;
+               return LDB_ERR_OPERATIONS_ERROR;
        }
 
        for (i=0; i<val->length; i++) {
                if (!isprint(p[i]) || p[i] == '\n') {
-                       return 1;
+                       return LDB_ERR_OPERATIONS_ERROR;
                }
        }
-       return 0;
+       return LDB_SUCCESS;
 }
 
 /* this macro is used to handle the return checking on fprintf_fn() */
@@ -444,12 +444,12 @@ static int next_attr(void *mem_ctx, char **s, const char **attr, struct ldb_val
                value->length = 0;
                *attr = "-";
                *s += 2;
-               return 0;
+               return LDB_SUCCESS;
        }
 
        p = strchr(*s, ':');
        if (!p) {
-               return -1;
+               return LDB_ERR_OPERATIONS_ERROR;
        }
 
        *p++ = 0;
@@ -487,7 +487,7 @@ static int next_attr(void *mem_ctx, char **s, const char **attr, struct ldb_val
                int len = ldb_base64_decode((char *)value->data);
                if (len == -1) {
                        /* it wasn't valid base64 data */
-                       return -1;
+                       return LDB_ERR_OPERATIONS_ERROR;
                }
                value->length = len;
        }
@@ -496,11 +496,11 @@ static int next_attr(void *mem_ctx, char **s, const char **attr, struct ldb_val
                int len = ldb_read_data_file(mem_ctx, value);
                if (len == -1) {
                        /* an error occured hile trying to retrieve the file */
-                       return -1;
+                       return LDB_ERR_OPERATIONS_ERROR;
                }
        }
 
-       return 0;
+       return LDB_SUCCESS;
 }
 
 
index c0cd616a76e63bb02f1530b2de2d729d09b08264..046d36edf184d6418f46f1ead449a1a667a27c05 100644 (file)
@@ -279,16 +279,16 @@ int ldb_register_module(const struct ldb_module_ops *ops)
        struct ops_list_entry *entry = talloc(talloc_autofree_context(), struct ops_list_entry);
 
        if (ldb_find_module_ops(ops->name) != NULL)
-               return -1;
+               return LDB_ERR_OPERATIONS_ERROR;
 
        if (entry == NULL)
-               return -1;
+               return LDB_ERR_OPERATIONS_ERROR;
 
        entry->ops = ops;
        entry->next = registered_modules;
        registered_modules = entry;
 
-       return 0;
+       return LDB_SUCCESS;
 }
 
 void *ldb_dso_load_symbol(struct ldb_context *ldb, const char *name,
index a59e81becdd4e50eb764484eba6b2ae1a27254ce..716f34d660eb69d1c1809101ab416542267d53ce 100644 (file)
@@ -158,13 +158,13 @@ static int operational_search_post_process(struct ldb_module *module,
                }
        }
 
-       return 0;
+       return LDB_SUCCESS;
 
 failed:
        ldb_debug_set(module->ldb, LDB_DEBUG_WARNING, 
                      "operational_search_post_process failed for attribute '%s'\n", 
                      attrs[a]);
-       return -1;
+       return LDB_ERR_OPERATIONS_ERROR;
 }
 
 
index b62b1f92cbd7d0271fffbbef452664bfb89662fe..c7296a1edfeeca2bfa50fff2ea7808f785ecf66c 100644 (file)
@@ -86,7 +86,7 @@ int store_destructor(struct results_store *store)
                store->priv->store = NULL;
        }
 
-       return 0;
+       return LDB_SUCCESS;
 }
 
 static struct results_store *new_store(struct private_data *priv)
index 0cd29ac4b7e0fc8839944481daf60fb908a3b805..15df46354b558e04f498f4dcb2de2ea87edb5dd7 100644 (file)
@@ -90,7 +90,7 @@ static int skel_destructor(struct ldb_module *ctx)
        struct private_data *data = talloc_get_type(ctx->private_data, struct private_data);
        /* put your clean-up functions here */
        if (data->some_private_data) talloc_free(data->some_private_data);
-       return 0;
+       return LDB_SUCCESS;
 }
 
 static int skel_request(struct ldb_module *module, struct ldb_request *req)