Skip to content

Instantly share code, notes, and snippets.

@superbobry
Created March 12, 2015 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save superbobry/13198f038a92f63e0eae to your computer and use it in GitHub Desktop.
Save superbobry/13198f038a92f63e0eae to your computer and use it in GitHub Desktop.
UCSC style
struct chromNameCallbackContext
/* Some stuff that the bPlusTree traverser needs for context. */
{
struct bbiChromInfo *list; /* The list we are building. */
boolean isSwapped; /* Need to byte-swap things? */
};
static void chromNameCallback(void *context, void *key, int keySize, void *val, int valSize)
/* Callback that captures chromInfo from bPlusTree. */
{
struct chromNameCallbackContext *c = context;
struct bbiChromInfo *info;
struct bbiChromIdSize *idSize = val;
assert(valSize == sizeof(*idSize));
chromIdSizeHandleSwapped(c->isSwapped, idSize);
AllocVar(info);
info->name = cloneStringZ(key, keySize);
info->id = idSize->chromId;
info->size = idSize->chromSize;
slAddHead(&c->list, info);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment