From af90cc3cb182162b1b3751eabbad81db084cedc2 Mon Sep 17 00:00:00 2001 From: Charles Manning Date: Thu, 18 Nov 2010 13:47:47 +1300 Subject: [PATCH] yaffs direst tests: Clean up error to string converter Compilation and comment clean ups. Signed-off-by: Charles Manning --- direct/python/yaffs_error_converter.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/direct/python/yaffs_error_converter.c b/direct/python/yaffs_error_converter.c index 1fd7b21..1701c5e 100644 --- a/direct/python/yaffs_error_converter.c +++ b/direct/python/yaffs_error_converter.c @@ -13,12 +13,12 @@ #include "yaffs_error_converter.h" -typedef struct error_codes_template { +struct error_entry { int code; char * text; -}error_entry; +}; -const error_entry error_list[] = { +static const struct error_entry error_list[] = { { ENOMEM , "ENOMEM" }, { EBUSY , "EBUSY"}, { ENODEV , "ENODEV"}, @@ -43,9 +43,11 @@ const error_entry error_list[] = { const char * yaffs_error_to_str(int err) { - error_entry *e = error_list; + const struct error_entry *e = error_list; + if (err < 0) err = -err; + while(e->code && e->text){ if(err == e->code) return e->text; @@ -53,4 +55,3 @@ const char * yaffs_error_to_str(int err) } return "Unknown error code"; } - -- 2.30.2