File: misc.h

package info (click to toggle)
fbi 2.14-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 2,044 kB
  • sloc: ansic: 24,426; sh: 138; perl: 16; makefile: 8
file content (10 lines) | stat: -rw-r--r-- 276 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
/*
 * misc useful #defines ...
 */
#include <stddef.h>

#define container_of(ptr, type, member) ({			\
        const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
        (type *)( (char *)__mptr - offsetof(type,member) );})

#define array_size(x) (sizeof(x)/sizeof(x[0]))