Browse Source

llist: Add missing const qualifier in llist cast method

The missing const qualifier prevents the llist_empty() C++ wrapper
function from being compiled successfully when it is used.

Sponsored-by: On-Waves ehf
jerlbeck/wip/fix-pacch-alloc
Jacob Erlbeck 7 years ago
parent
commit
af387e2199
  1. 2
      src/cxx_linuxlist.h
  2. 4
      tests/llist/LListTest.cpp

2
src/cxx_linuxlist.h

@ -45,7 +45,7 @@ struct LListHead {
return *static_cast<llist_head *>(static_cast<void *>(this));
}
const llist_head &llist() const {
return *static_cast<llist_head *>(static_cast<void *>(this));
return *static_cast<const llist_head *>(static_cast<const void *>(this));
}
private:

4
tests/llist/LListTest.cpp

@ -48,10 +48,14 @@ static void test_linux_list()
printf("=== start %s ===\n", __func__);
OSMO_ASSERT(llist_empty(&elems));
llist_add_tail(&elem1.list, &elems);
llist_add_tail(&elem2.list, &elems);
llist_add_tail(&elem3.list, &elems);
OSMO_ASSERT(!llist_empty(&elems));
llist_for_each(pos, &elems) {
count += 1;
printf(" %i -> %s\n", count, pos->entry()->str);

Loading…
Cancel
Save