From: Charles Manning Date: Thu, 18 Nov 2010 00:47:47 +0000 (+1300) Subject: yaffs direst tests: Clean up error to string converter X-Git-Tag: linux-mainline-patchset-4~71 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=af90cc3cb182162b1b3751eabbad81db084cedc2;ds=sidebyside yaffs direst tests: Clean up error to string converter Compilation and comment clean ups. Signed-off-by: Charles Manning --- 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"; } -