From 97880e0237a80d76453d722aaa2912417a037f1b Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 19 Feb 2008 14:08:06 -0800 Subject: refstr_get(): handle NULL, force inline Make refstr_get() handle NULL correctly; force it to be an inline since it seems to make no difference for code size. --- com32/menu/refstr.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/com32/menu/refstr.h b/com32/menu/refstr.h index 593b0abb..8bec0182 100644 --- a/com32/menu/refstr.h +++ b/com32/menu/refstr.h @@ -22,10 +22,11 @@ #include #include -static inline const char *refstr_get(const char *r) +static inline __attribute__((always_inline)) +const char *refstr_get(const char *r) { - unsigned int *ref = (unsigned int *)r - 1; - ref++; + if (r) + ((unsigned int *)r)[-1]++; return r; } -- cgit v1.2.1