graphitemaster / libintrusive Goto Github PK
View Code? Open in Web Editor NEWIntrusive data structures for C
License: The Unlicense
Intrusive data structures for C
License: The Unlicense
I added only three lines to example.c
(see the comments below for the specific additions) which insert a fourth node into the tree and attempt to remove a node from the tree. This results in a segmentation fault at rb.c:169
.
void rb() {
printf(">> RB\n");
rb_tree_t tree;
rb_init(&tree, NULL);
test_rb_t a = { 1 };
test_rb_t b = { 2 };
test_rb_t c = { 3 };
test_rb_t d = { 4 }; /* Addition 1 */
rb_insert(&tree, &a.node, &test_rb_compare);
rb_insert(&tree, &b.node, &test_rb_compare);
rb_insert(&tree, &c.node, &test_rb_compare);
rb_insert(&tree, &d.node, &test_rb_compare); /* Addition 2 */
rb_remove(&tree, &a.node); /* Addition 3 */
// Display them
rb_node_t *node = rb_head(&tree);
while (node) {
rb_node_t *next = rb_next(node);
rb_node_t *prev = rb_prev(node);
test_rb_t *c = rb_ref(node, test_rb_t, node);
test_rb_t *n = next ? rb_ref(next, test_rb_t, node) : NULL;
test_rb_t *p = prev ? rb_ref(prev, test_rb_t, node) : NULL;
printf("current: %d, next: %d, prev: %d\n",
c->number,
n ? n->number : -1,
p ? p->number : -1);
node = next;
}
}
I know this project is fairly old and unmaintained, but I figured I might as well point this out in case future people attempt to use this as a resource.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.