summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
92be2ef)
I had a bug caused by using tal_len instead of tal_count: let's make
it explicit. @jb55 commented "ha. I always forget which one does which... Ack"
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-size_t tal_len(const tal_t *ptr)
+size_t tal_bytelen(const tal_t *ptr)
* Returns 0 if @ptr has no length property or is NULL, but be aware
* that that is also a valid size!
*/
* Returns 0 if @ptr has no length property or is NULL, but be aware
* that that is also a valid size!
*/
-#define tal_count(p) (tal_len(p) / sizeof(*p))
+#define tal_count(p) (tal_bytelen(p) / sizeof(*p))
- * tal_len - get the count of bytes in a tal_arr.
+ * tal_bytelen - get the count of bytes in a tal_arr.
* @ptr: The tal allocated object array (or NULL)
*
* Returns 0 if @ptr has no length property or NULL, but be aware that that is
* also a valid size!
*/
* @ptr: The tal allocated object array (or NULL)
*
* Returns 0 if @ptr has no length property or NULL, but be aware that that is
* also a valid size!
*/
-size_t tal_len(const tal_t *ptr);
+size_t tal_bytelen(const tal_t *ptr);
/**
* tal_first - get the first immediate tal object child.
/**
* tal_first - get the first immediate tal object child.
plan_tests(2 + 19 * 3);
p1 = NULL;
plan_tests(2 + 19 * 3);
p1 = NULL;
+ ok1(tal_bytelen(p1) == 0);
ok1(tal_count(p1) == 0);
for (i = 0; i < 3; i++) {
ok1(tal_count(p1) == 0);
for (i = 0; i < 3; i++) {