aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2018-10-17 16:28:25 +1300
committerDouglas Bagnall <dbagnall@samba.org>2018-10-18 13:17:30 +0200
commitce518f387f9f6742f642ce33901cd778375bb4fd (patch)
tree84400be344e133b1c45640eb9930b8014c71b34b
parent30e9c00f2d8ba6395deb4fe8734e41b1000f13f0 (diff)
downloadsamba-ce518f387f9f6742f642ce33901cd778375bb4fd.tar.gz
samba-ce518f387f9f6742f642ce33901cd778375bb4fd.tar.xz
samba-ce518f387f9f6742f642ce33901cd778375bb4fd.zip
ldb_ldif: be less horribly efficient in debugging
perf said all the time was in strlen. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Thu Oct 18 13:17:30 CEST 2018 on sn-devel-144
-rw-r--r--lib/ldb/common/ldb_ldif.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ldb/common/ldb_ldif.c b/lib/ldb/common/ldb_ldif.c
index e23b568707d..ec1859b5c0d 100644
--- a/lib/ldb/common/ldb_ldif.c
+++ b/lib/ldb/common/ldb_ldif.c
@@ -313,6 +313,7 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb,
for (i=0;i<msg->num_elements;i++) {
const struct ldb_schema_attribute *a;
+ size_t namelen = strlen(msg->elements[i].name);
if (msg->elements[i].name == NULL) {
ldb_debug(ldb, LDB_DEBUG_ERROR,
@@ -347,7 +348,6 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb,
CHECK_RET;
continue;
}
-
for (j=0;j<msg->elements[i].num_values;j++) {
struct ldb_val v;
bool use_b64_encode = false;
@@ -371,7 +371,7 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb,
CHECK_RET;
ret = base64_encode_f(ldb, fprintf_fn, private_data,
(char *)v.data, v.length,
- strlen(msg->elements[i].name)+3);
+ namelen + 3);
CHECK_RET;
ret = fprintf_fn(private_data, "\n");
CHECK_RET;
@@ -384,7 +384,7 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb,
} else {
ret = fold_string(fprintf_fn, private_data,
(char *)v.data, v.length,
- strlen(msg->elements[i].name)+2);
+ namelen + 2);
}
CHECK_RET;
ret = fprintf_fn(private_data, "\n");