summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2019-05-20 23:52:16 +0200
committerRenato Westphal <renato@opensourcerouting.org>2019-05-21 20:59:08 +0200
commit81fddbe7ae5defbe6b9a0c8716d317cfaf503a62 (patch)
treee19b153aa970369cfb32f39537de72ade98d9995 /tests/lib
parentlib: add missing extern "C" {} blocks to new headers (diff)
downloadfrr-81fddbe7ae5defbe6b9a0c8716d317cfaf503a62.tar.xz
frr-81fddbe7ae5defbe6b9a0c8716d317cfaf503a62.zip
*: rename new ForEach macros from the typesafe API
This is necessary to avoid a name collision with std::for_each from C++. Fixes the compilation of the gRPC northbound module. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/test_atomlist.c6
-rw-r--r--tests/lib/test_typelist.h8
2 files changed, 7 insertions, 7 deletions
diff --git a/tests/lib/test_atomlist.c b/tests/lib/test_atomlist.c
index 078e05e33..249fff8ed 100644
--- a/tests/lib/test_atomlist.c
+++ b/tests/lib/test_atomlist.c
@@ -308,7 +308,7 @@ static void run_tr(struct testrun *tr)
if (tr->sorted) {
uint64_t prevval = 0;
- for_each(asort, &shead, item) {
+ frr_each(asort, &shead, item) {
assert(item->val1 >= prevval);
prevval = item->val1;
c++;
@@ -316,7 +316,7 @@ static void run_tr(struct testrun *tr)
assert(c == asort_count(&shead));
} else {
prev = &dummy;
- for_each(alist, &ahead, item) {
+ frr_each(alist, &ahead, item) {
assert(item != prev);
prev = item;
c++;
@@ -335,7 +335,7 @@ static void dump(const char *lbl)
size_t ctr = 0;
printf("dumping %s:\n", lbl);
- for_each_safe(alist, &ahead, item) {
+ frr_each_safe(alist, &ahead, item) {
printf("%s %3zu %p %3"PRIu64" %3"PRIu64"\n", lbl, ctr++,
(void *)item, item->val1, item->val2);
}
diff --git a/tests/lib/test_typelist.h b/tests/lib/test_typelist.h
index f09175fea..b288f0bd8 100644
--- a/tests/lib/test_typelist.h
+++ b/tests/lib/test_typelist.h
@@ -105,7 +105,7 @@ static void ts_hash(const char *text, const char *expect)
SHA256_Init(&ctx);
SHA256_Update(&ctx, &count, sizeof(count));
- for_each (list, &head, item) {
+ frr_each (list, &head, item) {
struct {
uint32_t val_upper, val_lower, index;
} hashitem = {
@@ -177,7 +177,7 @@ static void concat(test_, TYPE)(void)
k = 0;
prev = NULL;
- for_each(list, &head, item) {
+ frr_each(list, &head, item) {
#if IS_HASH(REALTYPE) || IS_HEAP(REALTYPE)
/* hash table doesn't give sorting */
(void)prev;
@@ -303,7 +303,7 @@ static void concat(test_, TYPE)(void)
assert(l + list_count(&head) == k);
ts_hashx("del", "cb2e5d80f08a803ef7b56c15e981b681adcea214bebc2f55e12e0bfb242b07ca");
- for_each_safe(list, &head, item) {
+ frr_each_safe(list, &head, item) {
assert(item->scratchpad != 0);
if (item->val & 1) {
@@ -313,7 +313,7 @@ static void concat(test_, TYPE)(void)
}
}
assert(l + list_count(&head) == k);
- ts_hashx("for_each_safe+del", "e0beb71dd963a75af05b722b8e71b61b304587d860c8accdc4349067542b86bb");
+ ts_hashx("frr_each_safe+del", "e0beb71dd963a75af05b722b8e71b61b304587d860c8accdc4349067542b86bb");
#else /* !IS_SORTED */
prng = prng_new(0);