Message ID | 1361976054-28357-3-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 02/27/2013 10:40 PM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > add extra error level messages and add better guarding so we don't > fall off the end of the arrary. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpi/syntaxcheck/syntaxcheck.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/src/acpi/syntaxcheck/syntaxcheck.c b/src/acpi/syntaxcheck/syntaxcheck.c > index 5aee063..e4616d9 100644 > --- a/src/acpi/syntaxcheck/syntaxcheck.c > +++ b/src/acpi/syntaxcheck/syntaxcheck.c > @@ -48,6 +48,8 @@ static void syntaxcheck_free_advice(void); > #define ASL_WARNING2 1 > #define ASL_WARNING3 2 > #define ASL_ERROR 3 > +#define ASL_REMARK 4 > +#define ASL_OPTIMIZATION 5 > > static int syntaxcheck_init(fwts_framework *fw) > { > @@ -75,13 +77,14 @@ static const char *syntaxcheck_error_level(uint32_t error_code) > "warning (level 1)", > "warning (level 2)", > "error", > + "remark", > + "optimization", > "unknown", > }; > > - if (error_level > 3) > - error_level = 4; > + const int max_levels = (sizeof(error_levels) / sizeof(char*)) - 1; > > - return error_levels[error_level]; > + return error_levels[error_level > max_levels ? max_levels : error_level]; > } > > /* > Acked-by: Alex Hung <alex.hung@canonical.com>
On Wed, Feb 27, 2013 at 10:40 PM, Colin King <colin.king@canonical.com> wrote: > From: Colin Ian King <colin.king@canonical.com> > > add extra error level messages and add better guarding so we don't > fall off the end of the arrary. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpi/syntaxcheck/syntaxcheck.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/src/acpi/syntaxcheck/syntaxcheck.c b/src/acpi/syntaxcheck/syntaxcheck.c > index 5aee063..e4616d9 100644 > --- a/src/acpi/syntaxcheck/syntaxcheck.c > +++ b/src/acpi/syntaxcheck/syntaxcheck.c > @@ -48,6 +48,8 @@ static void syntaxcheck_free_advice(void); > #define ASL_WARNING2 1 > #define ASL_WARNING3 2 > #define ASL_ERROR 3 > +#define ASL_REMARK 4 > +#define ASL_OPTIMIZATION 5 > > static int syntaxcheck_init(fwts_framework *fw) > { > @@ -75,13 +77,14 @@ static const char *syntaxcheck_error_level(uint32_t error_code) > "warning (level 1)", > "warning (level 2)", > "error", > + "remark", > + "optimization", > "unknown", > }; > > - if (error_level > 3) > - error_level = 4; > + const int max_levels = (sizeof(error_levels) / sizeof(char*)) - 1; > > - return error_levels[error_level]; > + return error_levels[error_level > max_levels ? max_levels : error_level]; > } > > /* > -- > 1.8.1.2 > Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff --git a/src/acpi/syntaxcheck/syntaxcheck.c b/src/acpi/syntaxcheck/syntaxcheck.c index 5aee063..e4616d9 100644 --- a/src/acpi/syntaxcheck/syntaxcheck.c +++ b/src/acpi/syntaxcheck/syntaxcheck.c @@ -48,6 +48,8 @@ static void syntaxcheck_free_advice(void); #define ASL_WARNING2 1 #define ASL_WARNING3 2 #define ASL_ERROR 3 +#define ASL_REMARK 4 +#define ASL_OPTIMIZATION 5 static int syntaxcheck_init(fwts_framework *fw) { @@ -75,13 +77,14 @@ static const char *syntaxcheck_error_level(uint32_t error_code) "warning (level 1)", "warning (level 2)", "error", + "remark", + "optimization", "unknown", }; - if (error_level > 3) - error_level = 4; + const int max_levels = (sizeof(error_levels) / sizeof(char*)) - 1; - return error_levels[error_level]; + return error_levels[error_level > max_levels ? max_levels : error_level]; } /*