Commit 7d5c09c3 authored by Thomas Haller's avatar Thomas Haller

Squashed 'shared/c-rbtree/' changes from bf627e0c32..b46392d25d

b46392d25d build: use c-stdaux
61f21750be build: pull in c-stdaux
31fcf75afe build: sync with c-util
fec7b8f2da ci: add run with -DNDEBUG

git-subtree-dir: shared/c-rbtree
git-subtree-split: b46392d25de7a7bab67d48ef18bf8350b429cff5
parent 4f4e9665
#!/bin/bash
set -e
_CHERRY_LIB_M_GCC_NDEBUG=("CC=gcc" "CFLAGS='${CHERRY_LIB_CFLAGS[*]} ${CHERRY_LIB_CFLAGS_GCC[*]} -O2 -DNDEBUG'")
CHERRY_MATRIX+=("export ${_CHERRY_LIB_M_GCC_NDEBUG[*]}")
[submodule "subprojects/c-stdaux"]
path = subprojects/c-stdaux
url = https://github.com/c-util/c-stdaux.git
......@@ -30,8 +30,8 @@ AUTHORS-LGPL:
along with this program; If not, see <http://www.gnu.org/licenses/>.
COPYRIGHT: (ordered alphabetically)
Copyright (C) 2015-2018 Red Hat, Inc.
Copyright (C) 2015-2019 Red Hat, Inc.
AUTHORS: (ordered alphabetically)
David Herrmann <dh.herrmann@gmail.com>
David Rheinsberg <david.rheinsberg@gmail.com>
Tom Gundersen <teg@jklm.no>
This diff is collapsed.
This diff is collapsed.
AUTHORS-ASL
\ No newline at end of file
c-rbtree - Intrusive Red-Black Tree Collection
# c-rbtree - Intrusive Red-Black Tree Collection
CHANGES WITH 3:
## CHANGES WITH 3:
* Add more helpers. Add both a collection of iteratiors and helpers
for initializing a tree and checking if a tree is empty, without
......@@ -10,7 +10,7 @@ CHANGES WITH 3:
- Berlin, 2017-08-13
CHANGES WITH 2:
## CHANGES WITH 2:
* Relicense as ASL-2.0 to make c-rbtree useful for more projects. All
code is now fully available under the ASL-2.0. Nothing is covered by
......@@ -25,7 +25,7 @@ CHANGES WITH 2:
- Berlin, 2016-12-14
CHANGES WITH 1:
## CHANGES WITH 1:
* Initial release of c-rbtree.
......
c-rbtree - Intrusive Red-Black Tree Collection
ABOUT:
The c-rbtree project implements an intrusive collection based on
red-black trees in ISO-C11. Its API guarantees the user full control
over its data-structures, and rather limits itself to just the
tree-specific rebalancing and coloring operations.
For API documentation, see the c-rbtree.h header file, as well as the
docbook comments for each function.
DETAILS:
https://c-util.github.io/c-rbtree
BUG REPORTS:
https://github.com/c-util/c-rbtree/issues
GIT:
git@github.com:c-util/c-rbtree.git
https://github.com/c-util/c-rbtree.git
GITWEB:
https://github.com/c-util/c-rbtree
LICENSE:
Apache Software License 2.0
Lesser General Public License 2.1+
See AUTHORS for details.
REQUIREMENTS:
The requirements for c-siphash are:
libc (e.g., glibc >= 2.16)
At build-time, the following software is required:
meson >= 0.41
pkg-config >= 0.29
INSTALL:
The meson build-system is used for this project. Contact upstream
documentation for detailed help. In most situations the following
commands are sufficient to build and install from source:
$ mkdir build
$ cd build
$ meson setup ..
$ ninja
$ meson test
# ninja install
No custom configuration options are available.
c-rbtree
========
Intrusive Red-Black Tree Collection
The c-rbtree project implements an intrusive collection based on red-black
trees in ISO-C11. Its API guarantees the user full control over its
data-structures, and rather limits itself to just the tree-specific rebalancing
and coloring operations. For API documentation, see the c-rbtree.h header file,
as well as the docbook comments for each function.
### Project
* **Website**: <https://c-util.github.io/c-rbtree>
* **Bug Tracker**: <https://github.com/c-util/c-rbtree/issues>
### Requirements
The requirements for this project are:
* `libc` (e.g., `glibc >= 2.16`)
At build-time, the following software is required:
* `meson >= 0.41`
* `pkg-config >= 0.29`
### Build
The meson build-system is used for this project. Contact upstream
documentation for detailed help. In most situations the following
commands are sufficient to build and install from source:
```sh
mkdir build
cd build
meson setup ..
ninja
meson test
ninja install
```
No custom configuration options are available.
### Repository:
- **web**: <https://github.com/c-util/c-rbtree>
- **https**: `https://github.com/c-util/c-rbtree.git`
- **ssh**: `git@github.com:c-util/c-rbtree.git`
### License:
- **Apache-2.0** OR **LGPL-2.1-or-later**
- See AUTHORS file for details.
......@@ -12,4 +12,8 @@ project_description = 'Intrusive Red-Black Tree Collection'
add_project_arguments('-D_GNU_SOURCE', language: 'c')
mod_pkgconfig = import('pkgconfig')
sub_cstdaux = subproject('c-stdaux')
dep_cstdaux = sub_cstdaux.get_variable('libcstdaux_dep')
subdir('src')
......@@ -6,15 +6,10 @@
* which are used by our test-suite.
*/
#include <c-stdaux.h>
#include <stddef.h>
#include "c-rbtree.h"
/*
* Macros
*/
#define _public_ __attribute__((__visibility__("default")))
/*
* Nodes
*/
......
......@@ -24,11 +24,11 @@
*/
#include <assert.h>
#include <c-stdaux.h>
#include <stdalign.h>
#include <stddef.h>
#include "c-rbtree-private.h"
#include "c-rbtree.h"
#include "c-rbtree-private.h"
/*
* We use alignas(8) to enforce 64bit alignment of structure fields. This is
......@@ -53,7 +53,7 @@ static_assert(alignof(CRBTree) >= 8, "Invalid CRBTree alignment");
*
* Return: Pointer to leftmost child, or NULL.
*/
_public_ CRBNode *c_rbnode_leftmost(CRBNode *n) {
_c_public_ CRBNode *c_rbnode_leftmost(CRBNode *n) {
if (n)
while (n->left)
n = n->left;
......@@ -72,7 +72,7 @@ _public_ CRBNode *c_rbnode_leftmost(CRBNode *n) {
*
* Return: Pointer to rightmost child, or NULL.
*/
_public_ CRBNode *c_rbnode_rightmost(CRBNode *n) {
_c_public_ CRBNode *c_rbnode_rightmost(CRBNode *n) {
if (n)
while (n->right)
n = n->right;
......@@ -94,7 +94,7 @@ _public_ CRBNode *c_rbnode_rightmost(CRBNode *n) {
*
* Return: Pointer to left-deepest child, or NULL.
*/
_public_ CRBNode *c_rbnode_leftdeepest(CRBNode *n) {
_c_public_ CRBNode *c_rbnode_leftdeepest(CRBNode *n) {
if (n) {
for (;;) {
if (n->left)
......@@ -123,7 +123,7 @@ _public_ CRBNode *c_rbnode_leftdeepest(CRBNode *n) {
*
* Return: Pointer to right-deepest child, or NULL.
*/
_public_ CRBNode *c_rbnode_rightdeepest(CRBNode *n) {
_c_public_ CRBNode *c_rbnode_rightdeepest(CRBNode *n) {
if (n) {
for (;;) {
if (n->right)
......@@ -149,7 +149,7 @@ _public_ CRBNode *c_rbnode_rightdeepest(CRBNode *n) {
*
* Return: Pointer to next node, or NULL.
*/
_public_ CRBNode *c_rbnode_next(CRBNode *n) {
_c_public_ CRBNode *c_rbnode_next(CRBNode *n) {
CRBNode *p;
if (!c_rbnode_is_linked(n))
......@@ -175,7 +175,7 @@ _public_ CRBNode *c_rbnode_next(CRBNode *n) {
*
* Return: Pointer to previous node, or NULL.
*/
_public_ CRBNode *c_rbnode_prev(CRBNode *n) {
_c_public_ CRBNode *c_rbnode_prev(CRBNode *n) {
CRBNode *p;
if (!c_rbnode_is_linked(n))
......@@ -209,7 +209,7 @@ _public_ CRBNode *c_rbnode_prev(CRBNode *n) {
*
* Return: Pointer to next node, or NULL.
*/
_public_ CRBNode *c_rbnode_next_postorder(CRBNode *n) {
_c_public_ CRBNode *c_rbnode_next_postorder(CRBNode *n) {
CRBNode *p;
if (!c_rbnode_is_linked(n))
......@@ -253,7 +253,7 @@ _public_ CRBNode *c_rbnode_next_postorder(CRBNode *n) {
*
* Return: Pointer to previous node in post-order, or NULL.
*/
_public_ CRBNode *c_rbnode_prev_postorder(CRBNode *n) {
_c_public_ CRBNode *c_rbnode_prev_postorder(CRBNode *n) {
CRBNode *p;
if (!c_rbnode_is_linked(n))
......@@ -283,8 +283,8 @@ _public_ CRBNode *c_rbnode_prev_postorder(CRBNode *n) {
*
* Return: Pointer to first node, or NULL.
*/
_public_ CRBNode *c_rbtree_first(CRBTree *t) {
assert(t);
_c_public_ CRBNode *c_rbtree_first(CRBTree *t) {
c_assert(t);
return c_rbnode_leftmost(t->root);
}
......@@ -299,8 +299,8 @@ _public_ CRBNode *c_rbtree_first(CRBTree *t) {
*
* Return: Pointer to last node, or NULL.
*/
_public_ CRBNode *c_rbtree_last(CRBTree *t) {
assert(t);
_c_public_ CRBNode *c_rbtree_last(CRBTree *t) {
c_assert(t);
return c_rbnode_rightmost(t->root);
}
......@@ -319,8 +319,8 @@ _public_ CRBNode *c_rbtree_last(CRBTree *t) {
*
* Return: Pointer to first node in post-order, or NULL.
*/
_public_ CRBNode *c_rbtree_first_postorder(CRBTree *t) {
assert(t);
_c_public_ CRBNode *c_rbtree_first_postorder(CRBTree *t) {
c_assert(t);
return c_rbnode_leftdeepest(t->root);
}
......@@ -338,8 +338,8 @@ _public_ CRBNode *c_rbtree_first_postorder(CRBTree *t) {
*
* Return: Pointer to last node in post-order, or NULL.
*/
_public_ CRBNode *c_rbtree_last_postorder(CRBTree *t) {
assert(t);
_c_public_ CRBNode *c_rbtree_last_postorder(CRBTree *t) {
c_assert(t);
return t->root;
}
......@@ -452,14 +452,14 @@ static inline void c_rbnode_swap_child(CRBNode *old, CRBNode *new) {
* Note that this operates in O(1) time. Only the root-entry is updated to
* point to the new tree-root.
*/
_public_ void c_rbtree_move(CRBTree *to, CRBTree *from) {
_c_public_ void c_rbtree_move(CRBTree *to, CRBTree *from) {
CRBTree *t;
assert(!to->root);
c_assert(!to->root);
if (from->root) {
t = c_rbnode_pop_root(from->root);
assert(t == from);
c_assert(t == from);
to->root = from->root;
from->root = NULL;
......@@ -486,10 +486,10 @@ static inline void c_rbtree_paint_terminal(CRBNode *n) {
g = c_rbnode_parent(p);
gg = c_rbnode_parent(g);
assert(c_rbnode_is_red(p));
assert(c_rbnode_is_black(g));
assert(p == g->left || !g->left || c_rbnode_is_black(g->left));
assert(p == g->right || !g->right || c_rbnode_is_black(g->right));
c_assert(c_rbnode_is_red(p));
c_assert(c_rbnode_is_black(g));
c_assert(p == g->left || !g->left || c_rbnode_is_black(g->left));
c_assert(p == g->right || !g->right || c_rbnode_is_black(g->right));
if (p == g->left) {
if (n == p->right) {
......@@ -673,11 +673,11 @@ static inline void c_rbtree_paint(CRBNode *n) {
* In most cases you are better off using c_rbtree_add(). See there for details
* how tree-insertion works.
*/
_public_ void c_rbnode_link(CRBNode *p, CRBNode **l, CRBNode *n) {
assert(p);
assert(l);
assert(n);
assert(l == &p->left || l == &p->right);
_c_public_ void c_rbnode_link(CRBNode *p, CRBNode **l, CRBNode *n) {
c_assert(p);
c_assert(l);
c_assert(n);
c_assert(l == &p->left || l == &p->right);
c_rbnode_set_parent_and_flags(n, p, C_RBNODE_RED);
c_rbtree_store(&n->left, NULL);
......@@ -738,12 +738,12 @@ _public_ void c_rbnode_link(CRBNode *p, CRBNode **l, CRBNode *n) {
* than c_rbnode_unlink_stale()). In those cases, you should validate that a
* node is unlinked before you call c_rbtree_add().
*/
_public_ void c_rbtree_add(CRBTree *t, CRBNode *p, CRBNode **l, CRBNode *n) {
assert(t);
assert(l);
assert(n);
assert(!p || l == &p->left || l == &p->right);
assert(p || l == &t->root);
_c_public_ void c_rbtree_add(CRBTree *t, CRBNode *p, CRBNode **l, CRBNode *n) {
c_assert(t);
c_assert(l);
c_assert(n);
c_assert(!p || l == &p->left || l == &p->right);
c_assert(p || l == &t->root);
c_rbnode_set_parent_and_flags(n, p, C_RBNODE_RED);
c_rbtree_store(&n->left, NULL);
......@@ -795,7 +795,7 @@ static inline void c_rbnode_rebalance_terminal(CRBNode *p, CRBNode *previous) {
* Note that the parent must be red, otherwise
* it must have been handled by our caller.
*/
assert(c_rbnode_is_red(p));
c_assert(c_rbnode_is_red(p));
c_rbnode_set_parent_and_flags(s, p, c_rbnode_flags(s) | C_RBNODE_RED);
c_rbnode_set_parent_and_flags(p, c_rbnode_parent(p), c_rbnode_flags(p) & ~C_RBNODE_RED);
return;
......@@ -855,7 +855,7 @@ static inline void c_rbnode_rebalance_terminal(CRBNode *p, CRBNode *previous) {
if (!x || c_rbnode_is_black(x)) {
y = s->right;
if (!y || c_rbnode_is_black(y)) {
assert(c_rbnode_is_red(p));
c_assert(c_rbnode_is_red(p));
c_rbnode_set_parent_and_flags(s, p, c_rbnode_flags(s) | C_RBNODE_RED);
c_rbnode_set_parent_and_flags(p, c_rbnode_parent(p), c_rbnode_flags(p) & ~C_RBNODE_RED);
return;
......@@ -962,11 +962,11 @@ static inline void c_rbnode_rebalance(CRBNode *n) {
* This does *NOT* reset @n to being unlinked. If you need this, use
* c_rbtree_unlink().
*/
_public_ void c_rbnode_unlink_stale(CRBNode *n) {
_c_public_ void c_rbnode_unlink_stale(CRBNode *n) {
CRBTree *t;
assert(n);
assert(c_rbnode_is_linked(n));
c_assert(n);
c_assert(c_rbnode_is_linked(n));
/*
* There are three distinct cases during node removal of a tree:
......
......@@ -4,6 +4,10 @@
libcrbtree_symfile = join_paths(meson.current_source_dir(), 'libcrbtree.sym')
libcrbtree_deps = [
dep_cstdaux,
]
libcrbtree_private = static_library(
'crbtree-private',
[
......@@ -13,12 +17,14 @@ libcrbtree_private = static_library(
'-fvisibility=hidden',
'-fno-common',
],
dependencies: libcrbtree_deps,
pic: true,
)
libcrbtree_shared = shared_library(
'crbtree',
objects: libcrbtree_private.extract_all_objects(),
dependencies: libcrbtree_deps,
install: not meson.is_subproject(),
soversion: 0,
link_depends: libcrbtree_symfile,
......@@ -31,6 +37,7 @@ libcrbtree_shared = shared_library(
libcrbtree_dep = declare_dependency(
include_directories: include_directories('.'),
link_with: libcrbtree_private,
dependencies: libcrbtree_deps,
version: meson.project_version(),
)
......
......@@ -9,7 +9,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "c-rbtree.h"
typedef struct TestNode {
......
......@@ -10,11 +10,11 @@
#undef NDEBUG
#include <assert.h>
#include <c-stdaux.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "c-rbtree.h"
#include "c-rbtree-private.h"
......@@ -23,8 +23,8 @@ static size_t validate(CRBTree *t) {
CRBNode *n, *p, *o;
size_t count = 0;
assert(t);
assert(!t->root || c_rbnode_is_black(t->root));
c_assert(t);
c_assert(!t->root || c_rbnode_is_black(t->root));
/* traverse to left-most child, count black nodes */
i_black = 0;
......@@ -52,29 +52,29 @@ static size_t validate(CRBTree *t) {
++count;
/* verify natural order */
assert(n > o);
c_assert(n > o);
o = n;
/* verify consistency */
assert(!n->right || c_rbnode_parent(n->right) == n);
assert(!n->left || c_rbnode_parent(n->left) == n);
c_assert(!n->right || c_rbnode_parent(n->right) == n);
c_assert(!n->left || c_rbnode_parent(n->left) == n);
/* verify 2) */
if (!c_rbnode_parent(n))
assert(c_rbnode_is_black(n));
c_assert(c_rbnode_is_black(n));
if (c_rbnode_is_red(n)) {
/* verify 4) */
assert(!n->left || c_rbnode_is_black(n->left));
assert(!n->right || c_rbnode_is_black(n->right));
c_assert(!n->left || c_rbnode_is_black(n->left));
c_assert(!n->right || c_rbnode_is_black(n->right));
} else {
/* verify 1) */
assert(c_rbnode_is_black(n));
c_assert(c_rbnode_is_black(n));
}
/* verify 5) */
if (!n->left && !n->right)
assert(i_black == n_black);
c_assert(i_black == n_black);
/* get next node */
if (n->right) {
......@@ -106,9 +106,9 @@ static size_t validate(CRBTree *t) {
static void insert(CRBTree *t, CRBNode *n) {
CRBNode **i, *p;
assert(t);
assert(n);
assert(!c_rbnode_is_linked(n));
c_assert(t);
c_assert(n);
c_assert(!c_rbnode_is_linked(n));
i = &t->root;
p = NULL;
......@@ -117,7 +117,7 @@ static void insert(CRBTree *t, CRBNode *n) {
if (n < *i) {
i = &(*i)->left;
} else {
assert(n > *i);
c_assert(n > *i);
i = &(*i)->right;
}
}
......@@ -146,20 +146,20 @@ static void test_shuffle(void) {
/* allocate and initialize all nodes */
for (i = 0; i < sizeof(nodes) / sizeof(*nodes); ++i) {
nodes[i] = malloc(sizeof(*nodes[i]));
assert(nodes[i]);
c_assert(nodes[i]);
c_rbnode_init(nodes[i]);
}
/* shuffle nodes and validate *empty* tree */
shuffle(nodes, sizeof(nodes) / sizeof(*nodes));
n = validate(&t);
assert(n == 0);
c_assert(n == 0);
/* add all nodes and validate after each insertion */
for (i = 0; i < sizeof(nodes) / sizeof(*nodes); ++i) {
insert(&t, nodes[i]);
n = validate(&t);
assert(n == i + 1);
c_assert(n == i + 1);
}
/* shuffle nodes again */
......@@ -169,19 +169,19 @@ static void test_shuffle(void) {
for (i = 0; i < sizeof(nodes) / sizeof(*nodes); ++i) {
c_rbnode_unlink(nodes[i]);
n = validate(&t);
assert(n == sizeof(nodes) / sizeof(*nodes) - i - 1);
c_assert(n == sizeof(nodes) / sizeof(*nodes) - i - 1);
}
/* shuffle nodes and validate *empty* tree again */
shuffle(nodes, sizeof(nodes) / sizeof(*nodes));
n = validate(&t);
assert(n == 0);
c_assert(n == 0);
/* add all nodes again */
for (i = 0; i < sizeof(nodes) / sizeof(*nodes); ++i) {
insert(&t, nodes[i]);
n = validate(&t);
assert(n == i + 1);
c_assert(n == i + 1);
}
/* 4 times, remove half of the nodes and add them again */
......@@ -193,7 +193,7 @@ static void test_shuffle(void) {
for (i = 0; i < sizeof(nodes) / sizeof(*nodes) / 2; ++i) {
c_rbnode_unlink(nodes[i]);
n = validate(&t);
assert(n == sizeof(nodes) / sizeof(*nodes) - i - 1);
c_assert(n == sizeof(nodes) / sizeof(*nodes) - i - 1);
}
/* shuffle the removed half */
......@@ -203,7 +203,7 @@ static void test_shuffle(void) {
for (i = 0; i < sizeof(nodes) / sizeof(*nodes) / 2; ++i) {
insert(&t, nodes[i]);
n = validate(&t);
assert(n == sizeof(nodes) / sizeof(*nodes) / 2 + i + 1);
c_assert(n == sizeof(nodes) / sizeof(*nodes) / 2 + i + 1);
}
}
......@@ -214,7 +214,7 @@ static void test_shuffle(void) {
for (i = 0; i < sizeof(nodes) / sizeof(*nodes); ++i) {
c_rbnode_unlink(nodes[i]);
n = validate(&t);
assert(n == sizeof(nodes) / sizeof(*nodes) - i - 1);
c_assert(n == sizeof(nodes) / sizeof(*nodes) - i - 1);
}
/* free nodes again */
......
This diff is collapsed.
......@@ -5,19 +5,19 @@
#undef NDEBUG
#include <assert.h>
#include <c-stdaux.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "c-rbtree.h"
#include "c-rbtree-private.h"
static void insert(CRBTree *t, CRBNode *n) {
CRBNode **i, *p;
assert(t);
assert(n);
assert(!c_rbnode_is_linked(n));
c_assert(t);
c_assert(n);
c_assert(!c_rbnode_is_linked(n));
i = &t->root;
p = NULL;
......@@ -26,7 +26,7 @@ static void insert(CRBTree *t, CRBNode *n) {
if (n < *i) {
i = &(*i)->left;
} else {
assert(n > *i);
c_assert(n > *i);
i = &(*i)->right;
}
}
......@@ -44,19 +44,19 @@ static void test_move(void) {
insert(&t1, &n[i]);
}
assert(!c_rbtree_is_empty(&t1));
assert(c_rbtree_is_empty(&t2));
c_assert(!c_rbtree_is_empty(&t1));
c_assert(c_rbtree_is_empty(&t2));
c_rbtree_move(&t2, &t1);
assert(c_rbtree_is_empty(&t1));
assert(!c_rbtree_is_empty(&t2));
c_assert(c_rbtree_is_empty(&t1));
c_assert(!c_rbtree_is_empty(&t2));
while (t2.root)
c_rbnode_unlink(t2.root);
assert(c_rbtree_is_empty(&t1));
assert(c_rbtree_is_empty(&t2));
c_assert(c_rbtree_is_empty(&t1));
c_assert(c_rbtree_is_empty(&t2));
}
int main(int argc, char **argv) {
......
......@@ -30,6 +30,7 @@
#undef NDEBUG
#include <assert.h>
#include <c-stdaux.h>
#include <errno.h>
#include <inttypes.h>
#include <sched.h>
......@@ -46,7 +47,6 @@
#include <sys/syscall.h>
#include <time.h>
#include <unistd.h>
#include "c-rbtree.h"
#include "c-rbtree-private.h"
......@@ -132,7 +132,7 @@ static void test_parent_start(TestContext *ctx) {
ctx->mapsize += ctx->n_nodes * sizeof(CRBNode*);
ctx->map = mmap(NULL, ctx->mapsize, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
assert(ctx->map != MAP_FAILED);
c_assert(ctx->map != MAP_FAILED);
ctx->tree = (void *)ctx->map;
ctx->node_mem = (void *)(ctx->tree + 1);
......@@ -161,10 +161,10 @@ static void test_parent_end(TestContext *ctx) {
int r;
for (i = 0; i < ctx->n_nodes; ++i)
assert(!c_rbnode_is_linked(ctx->nodes[i]));
c_assert(!c_rbnode_is_linked(ctx->nodes[i]));
r = munmap(ctx->map, ctx->mapsize);
assert(r >= 0);
c_assert(r >= 0);
}
static void test_parent_step(TestContext *ctx) {
......@@ -176,13 +176,13 @@ static void test_parent_step(TestContext *ctx) {
while (n) {
/* verify that we haven't visited @n, yet */
assert(!fetch_visit(n));
c_assert(!fetch_visit(n));
/* verify @n is a valid node */
for (i = 0; i < ctx->n_nodes; ++i)
if (n == ctx->nodes[i])
break;
assert(i < ctx->n_nodes);
c_assert(i < ctx->n_nodes);
/* pre-order traversal and marker for cycle detection */
if (n->left) {
......@@ -256,7 +256,7 @@ static int test_parallel(void) {
/* run child */
pid = fork();
assert(pid >= 0);
c_assert(pid >= 0);
if (pid == 0) {
r = test_parallel_child(&ctx);
_exit(r);
......@@ -293,7 +293,7 @@ static int test_parallel(void) {
if (r < 0 && errno == EIO)
return 77;
assert(r >= 0);
c_assert(r >= 0);
break;
case SIGURG:
......@@ -302,7 +302,7 @@ static int test_parallel(void) {
/* step child */
r = ptrace(PTRACE_SINGLESTEP, pid, 0, 0);
assert(r >= 0);
c_assert(r >= 0);