From: Roland McGrath Date: Wed, 6 May 2015 20:49:47 +0000 (-0700) Subject: libdwfl: Make dwfl_error.c C99-kosher. X-Git-Tag: elfutils-0.162~73 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d26aea9da7d618de41c797da405637dd67733956;p=platform%2Fupstream%2Felfutils.git libdwfl: Make dwfl_error.c C99-kosher. Signed-off-by: Roland McGrath --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index cbaad85..d9922b4 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,10 @@ +2015-05-06 Roland McGrath + + * dwfl_error.c (struct msgtable): Break type definition out of + the 'msgtable' initializer. + (msgtable): Make it a union of struct msgtable and a char array. + (msgstr): Use the full-table char array rather than the msg_0 entry. + 2015-04-23 Max Filippov * core-file.c (_compat_without_executable_dwfl_core_file_report): diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c index d9ca9e7..56ec2b0 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[] = {