ext/oj/dump_leaf.c in oj-3.1.4 vs ext/oj/dump_leaf.c in oj-3.2.0
- old
+ new
@@ -22,11 +22,11 @@
}
if (out->allocated) {
buf = REALLOC_N(out->buf, char, (size + BUFFER_EXTRA));
} else {
buf = ALLOC_N(char, (size + BUFFER_EXTRA));
- out->allocated = 1;
+ out->allocated = true;
memcpy(buf, out->buf, out->end - out->buf + BUFFER_EXTRA);
}
if (0 == buf) {
rb_raise(rb_eNoMemError, "Failed to create string. [%d:%s]\n", ENOSPC, strerror(ENOSPC));
}
@@ -212,11 +212,11 @@
void
oj_dump_leaf_to_json(Leaf leaf, Options copts, Out out) {
if (0 == out->buf) {
out->buf = ALLOC_N(char, 4096);
out->end = out->buf + 4095 - BUFFER_EXTRA; // 1 less than end plus extra for possible errors
- out->allocated = 1;
+ out->allocated = true;
}
out->cur = out->buf;
out->circ_cnt = 0;
out->opts = copts;
out->hash_cnt = 0;
@@ -231,10 +231,10 @@
size_t size;
FILE *f;
out.buf = buf;
out.end = buf + sizeof(buf) - BUFFER_EXTRA;
- out.allocated = 0;
+ out.allocated = false;
out.omit_nil = copts->dump_opts.omit_nil;
oj_dump_leaf_to_json(leaf, copts, &out);
size = out.cur - out.buf;
if (0 == (f = fopen(path, "w"))) {
rb_raise(rb_eIOError, "%s\n", strerror(errno));