MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / cson_value_new_integer

Function cson_value_new_integer

cson/cson.c:540–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

538 return 0;
539}
540cson_value *cson_value_new_integer(cson_int_t v)
541{
542 cson_value *val = calloc(1, sizeof(cson_value));
543 val->sql_type = SQLITE_INTEGER;
544 val->u.num = v;
545 val->value_bytes = snprintf(val->value_buf, sizeof(val->value_buf), "%" PRId64, v);
546 if (val->value_bytes < sizeof(val->value_buf)) {
547 val->value_text = val->value_buf;
548 } else {
549 val->value_text = malloc(val->value_bytes + 1);
550 sprintf(val->value_text, "%" PRId64, v);
551 }
552 return val;
553}
554char cson_value_is_integer(cson_value const *v)
555{
556 if (v->sql_type == SQLITE_INTEGER) return 1;

Callers 13

test_aFunction · 0.85
test_bFunction · 0.85
test_cFunction · 0.85
test_dFunction · 0.85
test_eFunction · 0.85
test_fFunction · 0.85
test_hFunction · 0.85
test_mFunction · 0.85
cson__result_int64Function · 0.85
cson_new_intFunction · 0.85
eventlog_bind_int64Function · 0.85
eventlog_deadlock_cycleFunction · 0.85

Calls 2

callocFunction · 0.85
mallocFunction · 0.85

Tested by 8

test_aFunction · 0.68
test_bFunction · 0.68
test_cFunction · 0.68
test_dFunction · 0.68
test_eFunction · 0.68
test_fFunction · 0.68
test_hFunction · 0.68
test_mFunction · 0.68