Sasha,
  I am doing some plugin work, and ran into both of the cases this patch 
addresses.

From 680195f393a8c3a5036fc1c8afe76ae7bac5d3cb Mon Sep 17 00:00:00 2001
From: Tim Meier <[EMAIL PROTECTED]>
Date: Thu, 28 Aug 2008 15:10:35 -0700
Subject: [PATCH] opensm: osm_opensm.c - changed load_plugins() arg to const

Made a copy of the list of plugin names, so the parser would
not destroy the original copy.  Also now supports passing in
pointers to string constants.

Signed-off-by: Tim Meier <[EMAIL PROTECTED]>
---
 opensm/opensm/osm_opensm.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/opensm/opensm/osm_opensm.c b/opensm/opensm/osm_opensm.c
index 6cf4726..65fd632 100644
--- a/opensm/opensm/osm_opensm.c
+++ b/opensm/opensm/osm_opensm.c
@@ -244,12 +244,13 @@ void osm_opensm_destroy(IN osm_opensm_t * const p_osm)
        osm_log_destroy(&p_osm->log);
 }

-static void load_plugins(osm_opensm_t *osm, char *plugin_names)
+static void load_plugins(osm_opensm_t *osm, const char *plugin_names)
 {
        osm_epi_plugin_t *epi;
-       char *name, *p;
+       char *p_names, *name, *p;

-       name = strtok_r(plugin_names, " \t\n", &p);
+       p_names = strdup(plugin_names);
+       name = strtok_r(p_names, " \t\n", &p);
        while (name && *name) {
                epi = osm_epi_construct(osm, name);
                if (!epi)
@@ -259,6 +260,7 @@ static void load_plugins(osm_opensm_t *osm, char 
*plugin_names)
                        cl_qlist_insert_tail(&osm->plugin_list, &epi->list);
                name = strtok_r(NULL, " \t\n", &p);
        }
+       free(p_names);
 }

 /**********************************************************************
--
1.5.4.5


--
Timothy A. Meier
Computer Scientist
ICCD/High Performance Computing
925.422.3341
[EMAIL PROTECTED]
>From 680195f393a8c3a5036fc1c8afe76ae7bac5d3cb Mon Sep 17 00:00:00 2001
From: Tim Meier <[EMAIL PROTECTED]>
Date: Thu, 28 Aug 2008 15:10:35 -0700
Subject: [PATCH] opensm: osm_opensm.c - changed load_plugins() arg to const

Made a copy of the list of plugin names, so the parser would
not destroy the original copy.  Also now supports passing in
pointers to string constants.

Signed-off-by: Tim Meier <[EMAIL PROTECTED]>
---
 opensm/opensm/osm_opensm.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/opensm/opensm/osm_opensm.c b/opensm/opensm/osm_opensm.c
index 6cf4726..65fd632 100644
--- a/opensm/opensm/osm_opensm.c
+++ b/opensm/opensm/osm_opensm.c
@@ -244,12 +244,13 @@ void osm_opensm_destroy(IN osm_opensm_t * const p_osm)
        osm_log_destroy(&p_osm->log);
 }
 
-static void load_plugins(osm_opensm_t *osm, char *plugin_names)
+static void load_plugins(osm_opensm_t *osm, const char *plugin_names)
 {
        osm_epi_plugin_t *epi;
-       char *name, *p;
+       char *p_names, *name, *p;
 
-       name = strtok_r(plugin_names, " \t\n", &p);
+       p_names = strdup(plugin_names);
+       name = strtok_r(p_names, " \t\n", &p);
        while (name && *name) {
                epi = osm_epi_construct(osm, name);
                if (!epi)
@@ -259,6 +260,7 @@ static void load_plugins(osm_opensm_t *osm, char 
*plugin_names)
                        cl_qlist_insert_tail(&osm->plugin_list, &epi->list);
                name = strtok_r(NULL, " \t\n", &p);
        }
+       free(p_names);
 }
 
 /**********************************************************************
-- 
1.5.4.5

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to