From aa848c12eba441700557af78cb2ad23661d56f21 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 31 May 2011 08:44:02 +1000 Subject: s3-lib: Use ARRAY_SIZE() to walk the error mapping tables This gives a constant termination condition, and may help the compiler. Andrew Bartlett --- source3/lib/errmap_unix.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c index f0ae217222..90fd9d68c8 100644 --- a/source3/lib/errmap_unix.c +++ b/source3/lib/errmap_unix.c @@ -111,7 +111,6 @@ static const struct { #ifdef ENOTSUP { ENOTSUP, NT_STATUS_NOT_SUPPORTED}, #endif - { 0, NT_STATUS_OK } }; /********************************************************************* @@ -134,10 +133,10 @@ NTSTATUS map_nt_error_from_unix(int unix_error) } /* Look through list */ - while(unix_nt_errmap[i].unix_error != 0) { - if (unix_nt_errmap[i].unix_error == unix_error) + for (i=0;i