extern CAMLprim
value kc_size(value caml_db)
{
  CAMLparam1(caml_db);
  CAMLlocal1(val);

  KCDB* db = get_db(caml_db);
  int64_t size = kcdbsize(db);
  val = copy_int64(size);
  
  CAMLreturn(val);
}
Exemplo n.º 2
0
/* print members of database */
static void dbmetaprint(KCDB* db, int32_t verbose) {
    char* status, *rp;
    if (verbose) {
        status = kcdbstatus(db);
        if (status) {
            rp = status;
            while (*rp != '\0') {
                if (*rp == '\t') {
                    printf(": ");
                } else {
                    putchar(*rp);
                }
                rp++;
            }
            kcfree(status);
        }
    } else {
        oprintf("count: %ld\n", (long)kcdbcount(db));
        oprintf("size: %ld\n", (long)kcdbsize(db));
    }
}