mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-29 07:58:06 -04:00
spa/buffer: rename SPA_MEMBER to SPA_PTROFF
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a type-casting the result. Rename to SPA_PTROFF which is more expressive (and has the same number of characters so we don't need to re-indent).
This commit is contained in:
parent
e598d0a422
commit
2405f0942b
92 changed files with 248 additions and 227 deletions
|
|
@ -132,8 +132,19 @@ struct spa_fraction {
|
|||
x; \
|
||||
})
|
||||
|
||||
#define SPA_MEMBER(b,o,t) ((t*)((uint8_t*)(b) + (int)(o)))
|
||||
#define SPA_MEMBER_ALIGN(b,o,a,t) SPA_PTR_ALIGN(SPA_MEMBER(b,o,t),a,t)
|
||||
/**
|
||||
* Return the address (buffer + offset) as pointer of \a type
|
||||
*/
|
||||
#define SPA_PTROFF(ptr_,offset_,type_) ((type_*)((uint8_t*)(ptr_) + (int)(offset_)))
|
||||
#define SPA_PTROFF_ALIGN(ptr_,offset_,alignment_,type_) \
|
||||
SPA_PTR_ALIGN(SPA_PTROFF(ptr_,offset_,type_),alignment_,type_)
|
||||
|
||||
|
||||
/**
|
||||
* Deprecated, use SPA_PTROFF and SPA_PTROFF_ALIGN instead
|
||||
*/
|
||||
#define SPA_MEMBER(b,o,t) SPA_PTROFF(b,o,t)
|
||||
#define SPA_MEMBER_ALIGN(b,o,a,t) SPA_PTROFF_ALIGN(b,o,a,t)
|
||||
|
||||
#define SPA_CONTAINER_OF(p,t,m) (t*)((uint8_t*)p - offsetof (t,m))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue