1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-16 00:23:52 +03:00

r14161: return early if we know the job is already finished

This commit is contained in:
Simo Sorce
2006-03-10 15:27:16 +00:00
committed by Gerald (Jerry) Carter
parent bce4db8d1c
commit 09f6f552d7
4 changed files with 29 additions and 10 deletions

View File

@@ -57,9 +57,9 @@ struct lsql_async_context {
int (*callback)(struct ldb_context *, void *, struct ldb_async_result *);
};
static struct ldb_async_handle *init_lsql_handle(struct lsqlite3_private *lsqlite3, struct ldb_module *module,
void *context,
int (*callback)(struct ldb_context *, void *, struct ldb_async_result *))
static struct ldb_async_handle *init_handle(struct lsqlite3_private *lsqlite3, struct ldb_module *module,
void *context,
int (*callback)(struct ldb_context *, void *, struct ldb_async_result *))
{
struct lsql_async_context *ac;
struct ldb_async_handle *h;
@@ -81,6 +81,9 @@ static struct ldb_async_handle *init_lsql_handle(struct lsqlite3_private *lsqlit
h->private_data = (void *)ac;
h->state = LDB_ASYNC_INIT;
h->status = LDB_SUCCESS;
ac->module = module;
ac->context = context;
ac->callback = callback;
@@ -899,7 +902,7 @@ int lsql_search_async(struct ldb_module *module, const struct ldb_dn *base,
char *query = NULL;
int ret;
*handle = init_lsql_handle(lsqlite3, module, context, callback);
*handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
talloc_free(*handle);
return LDB_ERR_OPERATIONS_ERROR;
@@ -1111,7 +1114,7 @@ static int lsql_add_async(struct ldb_module *module, struct ldb_message *msg,
int i;
int ret = LDB_ERR_OPERATIONS_ERROR;
*handle = init_lsql_handle(lsqlite3, module, context, callback);
*handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
goto failed;
}
@@ -1267,7 +1270,7 @@ static int lsql_modify_async(struct ldb_module *module, const struct ldb_message
int i;
int ret = LDB_ERR_OPERATIONS_ERROR;
*handle = init_lsql_handle(lsqlite3, module, context, callback);
*handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
goto failed;
}
@@ -1481,7 +1484,7 @@ static int lsql_delete_async(struct ldb_module *module, const struct ldb_dn *dn,
int ret = LDB_ERR_OPERATIONS_ERROR;
*handle = init_lsql_handle(lsqlite3, module, context, callback);
*handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
goto failed;
}
@@ -1559,7 +1562,7 @@ static int lsql_rename_async(struct ldb_module *module, const struct ldb_dn *old
char *query;
int ret = LDB_ERR_OPERATIONS_ERROR;
*handle = init_lsql_handle(lsqlite3, module, context, callback);
*handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
goto failed;
}