Remove tal_len, use tal_count() or tal_bytelen().

tal_count() is used where there's a type, even if it's char or u8, and
tal_bytelen() is going to replace tal_len() for clarity: it's only needed
where a pointer is void.

We shim tal_bytelen() for now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-07-28 15:30:16 +09:30
committed by Christian Decker
parent eae9b81099
commit 5cf34d6618
57 changed files with 200 additions and 195 deletions

View File

@@ -60,7 +60,7 @@ int main(void)
assert(!feature_offered(bits, 16));
/* We always support no features. */
memset(bits, 0, tal_len(bits));
memset(bits, 0, tal_count(bits));
assert(features_supported(bits, bits));
/* We must support our own features. */
@@ -70,18 +70,18 @@ int main(void)
/* We can add random odd features, no problem. */
for (size_t i = 1; i < 16; i += 2) {
bits = tal_dup_arr(tmpctx, u8, lf, tal_len(lf), 0);
bits = tal_dup_arr(tmpctx, u8, lf, tal_count(lf), 0);
set_bit(&bits, i);
assert(features_supported(gf, bits));
bits = tal_dup_arr(tmpctx, u8, gf, tal_len(gf), 0);
bits = tal_dup_arr(tmpctx, u8, gf, tal_count(gf), 0);
set_bit(&bits, i);
assert(features_supported(bits, lf));
}
/* We can't add random even features. */
for (size_t i = 0; i < 16; i += 2) {
bits = tal_dup_arr(tmpctx, u8, lf, tal_len(lf), 0);
bits = tal_dup_arr(tmpctx, u8, lf, tal_count(lf), 0);
set_bit(&bits, i);
/* Special case for missing compulsory feature */
@@ -93,7 +93,7 @@ int main(void)
ARRAY_SIZE(local_features)));
}
bits = tal_dup_arr(tmpctx, u8, gf, tal_len(gf), 0);
bits = tal_dup_arr(tmpctx, u8, gf, tal_count(gf), 0);
set_bit(&bits, i);
assert(features_supported(bits, lf)
== feature_supported(i, global_features,