Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save actsasflinn/348619 to your computer and use it in GitHub Desktop.
Save actsasflinn/348619 to your computer and use it in GitHub Desktop.
Tokyo Cabinet patch adds iterrec and iterout to tcadbmisc
--- tcadb.c.orig 2010-03-11 09:55:29.000000000 -0500
+++ tcadb.c 2010-03-13 15:34:13.000000000 -0500
@@ -2423,6 +2423,25 @@ TCLIST *tcadbmisc(TCADB *adb, const char
tclistdel(rv);
rv = NULL;
}
+ } else if(!strcmp(name, "iterrec")){
+ rv = tclistnew2(1);
+ int ksiz;
+ const char *kbuf = tcbdbcurkey3(adb->cur, &ksiz);
+ if(kbuf){
+ TCLISTPUSH(rv, kbuf, ksiz);
+ int vsiz;
+ const char *vbuf = tcbdbcurval3(adb->cur, &vsiz);
+ if(vbuf) TCLISTPUSH(rv, vbuf, vsiz);
+ } else {
+ tclistdel(rv);
+ rv = NULL;
+ }
+ } else if(!strcmp(name, "iterout")){
+ rv = tclistnew2(0);
+ if(!tcbdbcurout(adb->cur)){
+ tclistdel(rv);
+ rv = NULL;
+ }
} else if(!strcmp(name, "sync")){
rv = tclistnew2(1);
if(!tcadbsync(adb)){
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment