diff options
author | Roland McGrath <roland@hack.frob.com> | 2015-05-06 13:49:47 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2015-05-06 13:49:47 -0700 |
commit | d26aea9da7d618de41c797da405637dd67733956 (patch) | |
tree | 53a37dad779535c7c7f7fd0d717e9900290494cc /libdwfl/dwfl_error.c | |
parent | 59c1f12303e966fe79f5227b8dcdd8f287fffb66 (diff) | |
download | elfutils-d26aea9da7d618de41c797da405637dd67733956.tar.gz |
libdwfl: Make dwfl_error.c C99-kosher.
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Diffstat (limited to 'libdwfl/dwfl_error.c')
-rw-r--r-- | libdwfl/dwfl_error.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c index d9ca9e7e..56ec2b02 100644 --- a/libdwfl/dwfl_error.c +++ b/libdwfl/dwfl_error.c @@ -1,5 +1,5 @@ /* Error handling in libdwfl. - Copyright (C) 2005-2010 Red Hat, Inc. + Copyright (C) 2005-2015 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -54,18 +54,31 @@ dwfl_errno (void) INTDEF (dwfl_errno) -static const struct msgtable +struct msgtable { #define DWFL_ERROR(name, text) char msg_##name[sizeof text]; DWFL_ERRORS #undef DWFL_ERROR +}; + +static const union +{ + struct msgtable table; + char strings[ +#define DWFL_ERROR(name, text) + sizeof text + DWFL_ERRORS +#undef DWFL_ERROR + ]; } msgtable = { + .table = + { #define DWFL_ERROR(name, text) text, - DWFL_ERRORS + DWFL_ERRORS #undef DWFL_ERROR + } }; -#define msgstr (&msgtable.msg_NOERROR[0]) +#define msgstr (msgtable.strings) static const uint_fast16_t msgidx[] = { |