Changeset 36795edf in mainline for uspace/lib/c/generic/adt/list.c


Ignore:
Timestamp:
2021-03-12T19:16:51Z (3 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a85d5c6
Parents:
17fac946
Message:

Improve lists and other data structures

Provide more standard-compliant member_to_inst implementation that uses
offsetof. Avoid potential undefined behavior in list_foreach and
list_foreach_rev by avoiding assinging an unaligned pointer value. Use
size_t instead of unsigned long for list length.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/adt/list.c

    r17fac946 r36795edf  
    4141#include <adt/list.h>
    4242#include <stdbool.h>
     43#include <stdint.h>
    4344
    4445/** Check for membership
     
    100101 * @return              Number of items in the list.
    101102 */
    102 unsigned long list_count(const list_t *list)
     103size_t list_count(const list_t *list)
    103104{
    104         unsigned long count = 0;
     105        size_t count = 0;
    105106
    106107        link_t *link = list_first(list);
Note: See TracChangeset for help on using the changeset viewer.