Skip to content

Instantly share code, notes, and snippets.

@pietern
Created March 2, 2010 17:05
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 pietern/319683 to your computer and use it in GitHub Desktop.
Save pietern/319683 to your computer and use it in GitHub Desktop.
/*
* As backward only points to a non-header node,
* it would be possible to replace the ternary statement with
* simply "x->backwards", because the condition will always be false.
*
* ...right?
*/
static void zslInsert(zskiplist *zsl, double score, robj *obj) {
...
x->backward = (update[0] == zsl->header) ? NULL : update[0];
...
}
static int zslDelete(zskiplist *zsl, double score, robj *obj) {
....
if (x->forward[0]) {
x->forward[0]->backward = (x->backward == zsl->header) ?
NULL : x->backward;
} else {
zsl->tail = x->backward;
}
....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment