If the parser function is NULL, ctdb_rec_buffer_traverse will return the
amount of data used by ctdb_rec_data structures.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
return ret;
}
- ret = func(reqid, NULL, key, data, private_data);
- if (ret != 0) {
- break;
+ if (func != NULL) {
+ ret = func(reqid, NULL, key, data, private_data);
+ if (ret != 0) {
+ break;
+ }
}
offset += reclen;
}
- return ret;
+ if (ret != 0) {
+ return ret;
+ }
+
+ if (func == NULL) {
+ size_t *length = (size_t *)private_data;
+
+ *length = offset;
+ }
+
+ return 0;
}
int ctdb_rec_buffer_write(struct ctdb_rec_buffer *recbuf, int fd)