Last active
November 13, 2017 23:40
-
-
Save antirez/e3d1d761942dfc99e57d813688d1dc7c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void somefunc(rax *mytree) { | |
raxIterator iter; | |
raxStart(&iter,mytree); | |
/* As seek operator you can use >, <, >=, <=, == */ | |
raxSeek(&iter,(unsigned char*)"chromo",6,"<="); /* Seek key <= "chromo" */ | |
while(raxNext(&iter,NULL,0,NULL)) { /* or raxPrev() */ | |
printf("Current key: %.*s, val %p\n", | |
(int)iter.key_len, (char*)iter.key, iter.data); | |
} | |
/* ... More complex example ... */ | |
raxSeek(&iter,(unsigned char*)"foo",3,">"); /* Seek key > "foo" */ | |
while(raxNext(&iter,"zap",3,"<=")) { /* Return elements up to "zap" */ | |
printf("Current key: %.*s, val %p\n", | |
(int)iter.key_len, (char*)iter.key, iter.data); | |
} | |
raxStop(&iter); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment