BSON_ITERATOR_INIT(&it, in);
while ((bt = bson_iterator_next(&it)) != BSON_EOO) {
- bson b;
if ((bt == BSON_BINDATA) &&
(bson_iterator_bin_type(&it) == BSON_BIN_UUID) &&
(strcmp(EV_BOOT_ID, bson_iterator_key(&it)) == 0))
else if ((bt == BSON_OBJECT) &&
(strcmp(EV_TIMESTAMP, bson_iterator_key(&it)) == 0)) {
- bson_init_finished_data(&b, bson_iterator_value(&it));
- faultd_bson_get_timespec(&b, &ev->timestamp);
-
+ faultd_bson_iterator_timespec(&it, &ev->timestamp);
}
}
ret = 0;
bson_append_long(out, "nsec", data->tv_nsec);
)
-int faultd_bson_get_timespec(const bson *in, struct timespec *t)
+int faultd_bson_iterator_timespec(const bson_iterator *i, struct timespec *t)
{
int ret = -EINVAL;
bson_iterator it;
bool sec = false;
bool nsec = false;
- BSON_ITERATOR_INIT(&it, in);
+ bson_iterator_subiterator(i, &it);
while ((bt = bson_iterator_next(&it)) != BSON_EOO) {
if ((bt == BSON_LONG) &&
(strcmp("sec", bson_iterator_key(&it)) == 0)) {
}
DECLARE_BSON_APPEND_STRUCT(timespec);
-int faultd_bson_get_timespec(const bson *in, struct timespec *t);
+int faultd_bson_iterator_timespec(const bson_iterator *i, struct timespec *t);
#define BSON_EMPTY_SIZE (4 /* len */ + 1 /* \0 */)