Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Commits
3bef9d40
Commit
3bef9d40
authored
Feb 24, 2008
by
rswindell
Browse files
Created strListIndexOf() to return the index of the passed string pointer.
parent
93ceeed9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
src/xpdev/str_list.c
src/xpdev/str_list.c
+17
-2
src/xpdev/str_list.h
src/xpdev/str_list.h
+4
-1
No files found.
src/xpdev/str_list.c
View file @
3bef9d40
...
...
@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 200
6
Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 200
8
Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
...
...
@@ -43,7 +43,7 @@
#include "genwrap.h"
/* stricmp */
#include "str_list.h"
str_list_t
strListInit
()
str_list_t
strListInit
(
void
)
{
str_list_t
list
;
...
...
@@ -63,6 +63,21 @@ size_t strListCount(const str_list_t list)
return
(
i
);
}
int
strListIndexOf
(
const
str_list_t
list
,
const
char
*
str
)
{
size_t
i
;
if
(
list
==
NULL
)
return
-
1
;
for
(
i
=
0
;
list
[
i
]
!=
NULL
;
i
++
)
{
if
(
list
[
i
]
==
str
)
return
i
;
}
return
-
1
;
}
static
char
*
str_list_append
(
str_list_t
*
list
,
char
*
str
,
size_t
index
)
{
str_list_t
lp
;
...
...
src/xpdev/str_list.h
View file @
3bef9d40
...
...
@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 200
5
Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 200
8
Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
...
...
@@ -101,6 +101,9 @@ size_t strListMerge(str_list_t*, str_list_t append_list);
/* Count the number of strings in the list and returns the count */
size_t
strListCount
(
const
str_list_t
);
/* Returns the index of the specified str (by ptr compare) or -1 if not found */
int
strListIndexOf
(
const
str_list_t
,
const
char
*
str
);
/* Sort the strings in the string list */
void
strListSortAlpha
(
str_list_t
);
void
strListSortAlphaReverse
(
str_list_t
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment