/*
* Copyright (c) 2003 Nikodemus Siivola
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
{
int cmp = strcmp (str, tmp->str);
if (0 == cmp)
- return 1;
-
+ return 1;
+
if (0 < cmp)
- break;
+ break;
/* printf ("-skip- (%s)\n", tmp->str);*/
node = malloc (sizeof (node_t));
if (!node)
return 0;
-
+
node->next = tmp;
node->str = strdup (str);
if (! pre)
collection = node;
- else
+ else
pre->next = node;
return 1;
root = NULL;
node_t * tmp = collection;
while (len && tmp)
- {
- if (0 == strncmp (str, tmp->str, len))
- {
- root = tmp;
- return strdup (root->str);
- }
- else
- tmp = tmp->next;
- }
+ {
+ if (0 == strncmp (str, tmp->str, len))
+ {
+ root = tmp;
+ return strdup (root->str);
+ }
+ else
+ tmp = tmp->next;
+ }
return (char *)NULL;
}
else if (root && (0 == strncmp (str, root->str, len)))