diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-02-19 14:08:06 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-02-19 16:51:23 -0800 |
commit | 97880e0237a80d76453d722aaa2912417a037f1b (patch) | |
tree | a11015fc824f6aca9b96f1869e0e2813fa0e219f | |
parent | eb1cb641e1152fcdf29b9ac97e6597192e4282d4 (diff) | |
download | syslinux-97880e0237a80d76453d722aaa2912417a037f1b.tar.gz |
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.
-rw-r--r-- | com32/menu/refstr.h | 7 |
1 files 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 <stddef.h> #include <stdarg.h> -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; } |