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
This commit is contained in:
Jacob Erlbeck 2015-08-21 12:05:30 +02:00
parent 444bc82081
commit af387e2199
2 changed files with 5 additions and 1 deletions

View File

@ -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:

View File

@ -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);