Skip to contentSkip to conversation

osmtest - code cleanup

PATCH Applied Stan C. Smith 2 participants 6 messages Oct 12, 2009 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 osmtest - code cleanup

Remove unused ifdef __WIN__ & redundant include.

opensm/osmtest/osmtest.c +2 -8
index c6ec955..82a814e 100644
@@ -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"
#1 lore raw
Quoted 4 lines · Stan C. Smith

Remove unused ifdef __WIN__ & redundant include.

Applied. Thanks. The question is below.

Quoted 13 lines
opensm/osmtest/osmtest.c +0 -4
index c6ec955..82a814e 100644
@@ -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"
 
#2 lore raw
Quoted 25 lines · Sasha Khapyorsky
Quoted 4 lines · Stan C. Smith

Remove unused ifdef __WIN__ & redundant include.

Applied. Thanks. The question is below.

Quoted 17 lines
opensm/osmtest/osmtest.c +1 -6
index c6ec955..82a814e 100644 --- a/opensm/osmtest/osmtest.c
+++ 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"
#3 lore raw

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
index 3618ea3..f0f23c7 100644
@@ -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
#4 lore raw

RE: [PATCH] osmtest/osmtest.c: remove strings.h inclusion

Quoted 12 lines · Sasha Khapyorsky

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 -0
index 3618ea3..f0f23c7 100644

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...

#5 lore raw
In reply to Smith, Stan
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