[SCM] Samba Shared Repository - branch master updated - tevent-0-9-8-613-g1fa643b
Andrew Tridgell
tridge at samba.org
Mon Sep 21 17:32:01 MDT 2009
The branch, master has been updated
via 1fa643bdd731ffa6bc746bce0be5fa0f117b48d2 (commit)
via 4d984d0c05c8517aafa1aefcb73e46c63375ef51 (commit)
from a5cdf36c3f8e4bf0aadba1add1ca1f212a8189b0 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 1fa643bdd731ffa6bc746bce0be5fa0f117b48d2
Author: Andrew Tridgell <tridge at samba.org>
Date: Mon Sep 21 16:29:44 2009 -0700
s4-ldb: bit prettier output
commit 4d984d0c05c8517aafa1aefcb73e46c63375ef51
Author: Andrew Tridgell <tridge at samba.org>
Date: Mon Sep 21 16:29:22 2009 -0700
s4-ldb: fixed O(n^2) string handling in ldif debug print
-----------------------------------------------------------------------
Summary of changes:
source4/lib/ldb/common/ldb.c | 22 +++++++++++++++-------
source4/lib/ldb/common/ldb_ldif.c | 6 +++---
2 files changed, 18 insertions(+), 10 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index 2ad5905..02298c1 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -642,8 +642,12 @@ static void ldb_trace_request(struct ldb_context *ldb, struct ldb_request *req)
req->op.search.scope==LDB_SCOPE_SUBTREE?"sub":"UNKNOWN");
ldb_debug(ldb, LDB_DEBUG_TRACE, " expr: %s",
ldb_filter_from_tree(tmp_ctx, req->op.search.tree));
- for (i=0; req->op.search.attrs && req->op.search.attrs[i]; i++) {
- ldb_debug(ldb, LDB_DEBUG_TRACE, " attr: %s", req->op.search.attrs[i]);
+ if (req->op.search.attrs == NULL) {
+ ldb_debug(ldb, LDB_DEBUG_TRACE, " attr: <ALL>");
+ } else {
+ for (i=0; req->op.search.attrs[i]; i++) {
+ ldb_debug(ldb, LDB_DEBUG_TRACE, " attr: %s", req->op.search.attrs[i]);
+ }
}
break;
case LDB_DELETE:
@@ -691,11 +695,15 @@ static void ldb_trace_request(struct ldb_context *ldb, struct ldb_request *req)
break;
}
- for (i=0; req->controls && req->controls[i]; i++) {
- ldb_debug(ldb, LDB_DEBUG_TRACE, " control: %s crit:%u data:%s",
- req->controls[i]->oid,
- req->controls[i]->critical,
- req->controls[i]->data?"yes":"no");
+ if (req->controls == NULL) {
+ ldb_debug(ldb, LDB_DEBUG_TRACE, " control: <NONE>");
+ } else {
+ for (i=0; req->controls && req->controls[i]; i++) {
+ ldb_debug(ldb, LDB_DEBUG_TRACE, " control: %s crit:%u data:%s",
+ req->controls[i]->oid,
+ req->controls[i]->critical,
+ req->controls[i]->data?"yes":"no");
+ }
}
talloc_free(tmp_ctx);
diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c
index cde2132..b7ab730 100644
--- a/source4/lib/ldb/common/ldb_ldif.c
+++ b/source4/lib/ldb/common/ldb_ldif.c
@@ -783,7 +783,7 @@ static int ldif_printf_string(void *private_data, const char *fmt, ...)
struct ldif_write_string_state *state =
(struct ldif_write_string_state *)private_data;
va_list ap;
- size_t oldlen = strlen(state->string);
+ size_t oldlen = talloc_get_size(state->string);
va_start(ap, fmt);
state->string = talloc_vasprintf_append(state->string, fmt, ap);
@@ -791,8 +791,8 @@ static int ldif_printf_string(void *private_data, const char *fmt, ...)
if (!state->string) {
return -1;
}
-
- return strlen(state->string) - oldlen;
+
+ return talloc_get_size(state->string) - oldlen;
}
char *ldb_ldif_write_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
--
Samba Shared Repository
More information about the samba-cvs
mailing list