29 #define relptr(type) union { type *relptr_type; Size relptr_off; }
38 #define relptr_declare(type, relptrtype) \
39 typedef relptr(type) relptrtype
41 #ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P
42 #define relptr_access(base, rp) \
43 (AssertVariableIsOfTypeMacro(base, char *), \
44 (__typeof__((rp).relptr_type)) ((rp).relptr_off == 0 ? NULL : \
45 (base) + (rp).relptr_off - 1))
51 #define relptr_access(base, rp) \
52 (AssertVariableIsOfTypeMacro(base, char *), \
53 (void *) ((rp).relptr_off == 0 ? NULL : (base) + (rp).relptr_off - 1))
56 #define relptr_is_null(rp) \
57 ((rp).relptr_off == 0)
59 #define relptr_offset(rp) \
71 return val - base + 1;
75 #ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P
76 #define relptr_store(base, rp, val) \
77 (AssertVariableIsOfTypeMacro(base, char *), \
78 AssertVariableIsOfTypeMacro(val, __typeof__((rp).relptr_type)), \
79 (rp).relptr_off = relptr_store_eval((base), (char *) (val)))
85 #define relptr_store(base, rp, val) \
86 (AssertVariableIsOfTypeMacro(base, char *), \
87 (rp).relptr_off = relptr_store_eval((base), (char *) (val)))
90 #define relptr_copy(rp1, rp2) \
91 ((rp1).relptr_off = (rp2).relptr_off)
Assert(fmt[strlen(fmt) - 1] !='\n')
static Size relptr_store_eval(char *base, char *val)