osmtest - code cleanup
PATCH 1/1 osmtest - code cleanup
Remove unused ifdef __WIN__ & redundant include.
opensm/osmtest/osmtest.c +2 -8
@@ -43,19 +43,13 @@* */ -#ifdef __WIN__ -#pragma warning(disable : 4996) -#endif -#include <stdio.h> #include <stdlib.h> #include <string.h> -#ifdef __WIN__ -#include <complib/cl_timer.h> -#else +#ifndef __WIN__#include <strings.h> -#include <sys/time.h> #endif +#include <sys/time.h> #include <complib/cl_debug.h> #include "osmtest.h"
Sasha Khapyorsky
AppliedQuoted 4 lines · Stan C. Smith
Remove unused ifdef
__WIN__& redundant include.Signed-off-by stan smith <[email protected]>
Applied. Thanks. The question is below.
Quoted 13 lines
opensm/osmtest/osmtest.c +0
-4@@ -43,19 +43,13 @@* */ -#ifdef __WIN__ -#pragma warning(disable : 4996) -#endif -
opensm/osmtest/osmtest.c line 51
Quoted 10 lines
opensm/osmtest/osmtest.c +1
-4#include <stdio.h> #include <stdlib.h> #include <string.h> -#ifdef __WIN__ -#include <complib/cl_timer.h> -#else +#ifndef __WIN__#include <strings.h> -#include <sys/time.h> #endif
I suppose that windows should have string.h, right? Assuming so could we remove '#ifndef __WIN__' completely here?
Sasha
Quoted 5 lines
opensm/osmtest/osmtest.c +1
-0+#include <sys/time.h> #include <complib/cl_debug.h> #include "osmtest.h"
Quoted 25 lines · Sasha Khapyorsky
Quoted 4 lines · Stan C. Smith
Remove unused ifdef
__WIN__& redundant include.Signed-off-by stan smith <[email protected]>Applied. Thanks. The question is below.
Quoted 17 lines
opensm/osmtest/osmtest.c +1
-6+++ b/opensm/osmtest/osmtest.c@@ -43,19 +43,13 @@* */ -#ifdef __WIN__ -#pragma warning(disable : 4996) -#endif -#include <stdio.h> #include <stdlib.h> #include <string.h> -#ifdef __WIN__ -#include <complib/cl_timer.h>
Quoted 8 lines
opensm/osmtest/osmtest.c line 51
Quoted 5 lines
opensm/osmtest/osmtest.c +1
-2-#else +#ifndef __WIN__#include <strings.h> -#include <sys/time.h> #endif I suppose that windows should have
string.h, right? Assuming so could we remove '#ifndef__WIN__' completely here?
Yes - I missed this in the linux env. According to the strings.h file, if string.h is included prior, then strings.h is a nop. Seems the include of strings.h could be removed along with the ifndef __WIN__. Good catch.
How do you feel about replacing ifndef __WIN__ with ifdef __linux__ in other situations?
Quoted 6 lines
Sasha
Quoted 3 lines
opensm/osmtest/osmtest.c +1
-0+#include <sys/time.h> #include <complib/cl_debug.h> #include "osmtest.h"
PATCH 1/1 osmtest/osmtest.c: remove strings.h inclusion
Remove redundant strings.h inclusion (and associated ifndef __WIN__).
--- opensm/osmtest/osmtest.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
opensm/osmtest/osmtest.c +0 -3
@@ -46,9 +46,6 @@#include <stdio.h> #include <stdlib.h> #include <string.h> -#ifndef __WIN__ -#include <strings.h> -#endif #include <sys/time.h> #include <complib/cl_debug.h> #include "osmtest.h"
Signature · 1 line
1.6.5
RE: [PATCH] osmtest/osmtest.c: remove strings.h inclusion
Quoted 12 lines · Sasha Khapyorsky
Remove redundant
strings.hinclusion (and associated ifndef__WIN__).Signed-off-by Sasha Khapyorsky <[email protected]>--- opensm/osmtest/osmtest.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)opensm/osmtest/osmtest.c +0
-0
opensm/osmtest/osmtest.c line 51
Quoted 9 lines
opensm/osmtest/osmtest.c +0
-3@@ -46,9 +46,6 @@#include <stdio.h> #include <stdlib.h> #include <string.h> -#ifndef __WIN__ -#include <strings.h> -#endif #include <sys/time.h> #include <complib/cl_debug.h> #include "osmtest.h"
Looking better all the time...
Quoted 2 lines · Stan
How do you feel about replacing ifndef
__WIN__with ifdef__linux__in other situations?
He-he :) Don't like this:
1. The current porting is going from linux to windows and not otherwise.
2. 'ifndef __WIN__' is not the same as 'ifdef __LIN__' - there are a non-linux platforms with pretty compatible development tools (such as Solaris, MacOSX, couple of embedded-es, etc.).
Sasha