Changeset 36795edf in mainline
- Timestamp:
- 2021-03-12T19:16:51Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a85d5c6
- Parents:
- 17fac946
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/adt/hash_table.h
r17fac946 r36795edf 41 41 #include <stdbool.h> 42 42 #include <macros.h> 43 #include <member.h> 43 44 44 45 /** Opaque hash table link type. */ -
kernel/generic/include/adt/list.h
r17fac946 r36795edf 38 38 39 39 #include <assert.h> 40 #include <macros.h> 41 #include <member.h> 40 42 #include <stdbool.h> 41 43 #include <stddef.h> 44 #include <stdint.h> 42 45 #include <trace.h> 43 46 … … 89 92 90 93 #define list_get_instance(link, type, member) \ 91 ((type *) (((void *)(link)) - list_link_to_void(&(((type *) NULL)->member))))94 member_to_inst(link, type, member) 92 95 93 96 #define list_foreach(list, member, itype, iterator) \ 94 for (itype *iterator = NULL; iterator == NULL; iterator = (itype *) 1) \97 for (itype *iterator = NULL; iterator == NULL; iterator = &((itype *) NULL)[1]) \ 95 98 for (link_t *_link = (list).head.next; \ 96 99 iterator = list_get_instance(_link, itype, member), \ … … 98 101 99 102 #define list_foreach_rev(list, member, itype, iterator) \ 100 for (itype *iterator = NULL; iterator == NULL; iterator = (itype *) 1) \103 for (itype *iterator = NULL; iterator == NULL; iterator = &((itype *) NULL)[1]) \ 101 104 for (link_t *_link = (list).head.prev; \ 102 105 iterator = list_get_instance(_link, itype, member), \ … … 375 378 * 376 379 */ 377 static inline link_t *list_nth(const list_t *list, unsigned longn)378 { 379 unsigned longcnt = 0;380 static inline link_t *list_nth(const list_t *list, size_t n) 381 { 382 size_t cnt = 0; 380 383 381 384 link_t *link = list_first(list); … … 391 394 } 392 395 393 /** Verify that argument type is a pointer to link_t (at compile time).394 *395 * This can be used to check argument type in a macro.396 */397 static inline const void *list_link_to_void(const link_t *link)398 {399 return link;400 }401 402 396 /** Determine if link is used. 403 397 * -
kernel/generic/include/adt/odict.h
r17fac946 r36795edf 37 37 38 38 #include <errno.h> 39 #include <member.h> 39 40 #include <stdbool.h> 40 41 #include <stddef.h> … … 42 43 43 44 #define odict_get_instance(odlink, type, member) \ 44 ((type *)( (void *)(odlink) - ((void *) &((type *) NULL)->member)))45 member_to_inst(odlink, type, member) 45 46 46 47 extern void odict_initialize(odict_t *, odgetkey_t, odcmp_t); -
kernel/generic/include/macros.h
r17fac946 r36795edf 160 160 }) 161 161 162 #define member_to_inst(ptr_member, type, member_identif) \163 ((type *) (((void *) (ptr_member)) - \164 ((void *) &(((type *) 0)->member_identif))))165 166 162 /** Get the size of an array in array elements 167 163 * -
uspace/drv/bus/usb/ehci/hc.c
r17fac946 r36795edf 358 358 fibril_mutex_lock(&hc->guard); 359 359 360 usb_log_debug2("HC(%p): Scanning % lu pending endpoints", hc,360 usb_log_debug2("HC(%p): Scanning %zu pending endpoints", hc, 361 361 list_count(&hc->pending_endpoints)); 362 362 list_foreach_safe(hc->pending_endpoints, current, next) { -
uspace/drv/bus/usb/uhci/hc.h
r17fac946 r36795edf 41 41 #include <fibril.h> 42 42 #include <macros.h> 43 #include <member.h> 43 44 #include <stdbool.h> 44 45 #include <ddi.h> -
uspace/drv/bus/usb/vhc/vhcd.h
r17fac946 r36795edf 41 41 #include <async.h> 42 42 #include <macros.h> 43 #include <member.h> 43 44 44 45 #include <usb/host/hcd.h> -
uspace/drv/bus/usb/xhci/hc.h
r17fac946 r36795edf 38 38 39 39 #include <fibril_synch.h> 40 #include <member.h> 40 41 #include <usb/host/usb_transfer_batch.h> 41 42 #include <usb/host/utility.h> -
uspace/lib/c/generic/adt/hash_table.c
r17fac946 r36795edf 52 52 #include <adt/list.h> 53 53 #include <assert.h> 54 #include <member.h> 54 55 #include <stdlib.h> 55 56 #include <str.h> -
uspace/lib/c/generic/adt/list.c
r17fac946 r36795edf 41 41 #include <adt/list.h> 42 42 #include <stdbool.h> 43 #include <stdint.h> 43 44 44 45 /** Check for membership … … 100 101 * @return Number of items in the list. 101 102 */ 102 unsigned longlist_count(const list_t *list)103 size_t list_count(const list_t *list) 103 104 { 104 unsigned longcount = 0;105 size_t count = 0; 105 106 106 107 link_t *link = list_first(list); -
uspace/lib/c/include/adt/hash_table.h
r17fac946 r36795edf 41 41 #include <stdbool.h> 42 42 #include <macros.h> 43 #include <member.h> 43 44 44 45 /** Opaque hash table link type. */ -
uspace/lib/c/include/adt/list.h
r17fac946 r36795edf 38 38 39 39 #include <assert.h> 40 #include <member.h> 40 41 #include <stdbool.h> 41 42 #include <stddef.h> … … 85 86 86 87 #define list_get_instance(link, type, member) \ 87 ((type *) (((void *)(link)) - list_link_to_void(&(((type *) NULL)->member))))88 member_to_inst(link, type, member) 88 89 89 90 #define list_foreach(list, member, itype, iterator) \ 90 for (itype *iterator = NULL; iterator == NULL; iterator = (itype *) 1) \91 for (itype *iterator = NULL; iterator == NULL; iterator = &((itype *) NULL)[1]) \ 91 92 for (link_t *_link = (list).head.next; \ 92 93 iterator = list_get_instance(_link, itype, member), \ … … 94 95 95 96 #define list_foreach_rev(list, member, itype, iterator) \ 96 for (itype *iterator = NULL; iterator == NULL; iterator = (itype *) 1) \97 for (itype *iterator = NULL; iterator == NULL; iterator = &((itype *) NULL)[1]) \ 97 98 for (link_t *_link = (list).head.prev; \ 98 99 iterator = list_get_instance(_link, itype, member), \ … … 154 155 extern bool list_member(const link_t *, const list_t *); 155 156 extern void list_splice(list_t *, link_t *); 156 extern unsigned longlist_count(const list_t *);157 extern size_t list_count(const list_t *); 157 158 158 159 /** Returns true if the link is definitely part of a list. False if not sure. */ … … 394 395 * 395 396 */ 396 static inline link_t *list_nth(const list_t *list, unsigned longn)397 { 398 unsigned longcnt = 0;397 static inline link_t *list_nth(const list_t *list, size_t n) 398 { 399 size_t cnt = 0; 399 400 400 401 link_t *link = list_first(list); -
uspace/lib/c/include/macros.h
r17fac946 r36795edf 55 55 | ((((uint64_t) (up)) & 0xffffffff) << 32)) 56 56 57 #define member_to_inst(ptr_member, type, member_identif) \58 ((type *) (((void *) (ptr_member)) - \59 ((void *) &(((type *) 0)->member_identif))))60 61 57 #define _paddname(line) PADD_ ## line ## __ 62 58 #define _padd(width, line, n) uint ## width ## _t _paddname(line) [n] -
uspace/lib/nic/src/nic_addr_db.c
r17fac946 r36795edf 35 35 * @brief Generic hash-set based database of addresses 36 36 */ 37 37 38 #include "nic_addr_db.h" 38 39 #include <assert.h> … … 41 42 #include <errno.h> 42 43 #include <mem.h> 44 #include <member.h> 43 45 #include <adt/hash_table.h> 44 46 #include <macros.h> -
uspace/srv/audio/hound/hound_ctx.c
r17fac946 r36795edf 403 403 return ENOMEM; 404 404 } 405 log_verbose("CTX: %p: Mixing % lu streams", ctx,405 log_verbose("CTX: %p: Mixing %zu streams", ctx, 406 406 list_count(&ctx->streams)); 407 407 pcm_format_silence(buffer, size, &source->format); … … 413 413 log_warning("Not enough data in stream buffer"); 414 414 } 415 log_verbose("CTX: %p. Pushing audio to % lu connections", ctx,415 log_verbose("CTX: %p. Pushing audio to %zu connections", ctx, 416 416 list_count(&source->connections)); 417 417 list_foreach(source->connections, source_link, connection_t, conn) {
Note:
See TracChangeset
for help on using the changeset viewer.