summaryrefslogtreecommitdiff
path: root/src/libstrongswan/plugins/plugin_loader.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/plugins/plugin_loader.c')
-rw-r--r--src/libstrongswan/plugins/plugin_loader.c37
1 files changed, 8 insertions, 29 deletions
diff --git a/src/libstrongswan/plugins/plugin_loader.c b/src/libstrongswan/plugins/plugin_loader.c
index 4c5095e4a..6480a2760 100644
--- a/src/libstrongswan/plugins/plugin_loader.c
+++ b/src/libstrongswan/plugins/plugin_loader.c
@@ -12,7 +12,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
- * $Id: plugin_loader.c 4108 2008-06-25 14:53:49Z martin $
+ * $Id: plugin_loader.c 4144 2008-07-02 08:19:43Z martin $
*/
#define _GNU_SOURCE
@@ -96,43 +96,22 @@ static plugin_t* load_plugin(private_plugin_loader_t *this,
static int load(private_plugin_loader_t *this, char *path, char *list)
{
plugin_t *plugin;
- char *pos;
+ enumerator_t *enumerator;
+ char *token;
int count = 0;
- list = strdupa(list);
- while (TRUE)
+ enumerator = enumerator_create_token(list, " ", " ");
+ while (enumerator->enumerate(enumerator, &token))
{
- /* eat any whitespace in front */
- while (*list == ' ')
- {
- list++;
- }
- /* have we reached the end of the list? */
- if (!*list)
- {
- break;
- }
- pos = strchr(list, ' ');
- if (pos)
- {
- *pos++ = '\0';
- }
- plugin = load_plugin(this, path, list);
+ plugin = load_plugin(this, path, token);
if (plugin)
{ /* insert in front to destroy them in reverse order */
this->plugins->insert_last(this->plugins, plugin);
- this->names->insert_last(this->names, strdup(list));
+ this->names->insert_last(this->names, strdup(token));
count++;
}
- if (pos)
- {
- list = pos;
- }
- else
- {
- break;
- }
}
+ enumerator->destroy(enumerator);
return count;
}