Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
3bef9d40
Commit
3bef9d40
authored
17 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Created strListIndexOf() to return the index of the passed string pointer.
parent
93ceeed9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/xpdev/str_list.c
+17
-2
17 additions, 2 deletions
src/xpdev/str_list.c
src/xpdev/str_list.h
+4
-1
4 additions, 1 deletion
src/xpdev/str_list.h
with
21 additions
and
3 deletions
src/xpdev/str_list.c
+
17
−
2
View file @
3bef9d40
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* @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 *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* modify it under the terms of the GNU Lesser General Public License *
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
#include
"genwrap.h"
/* stricmp */
#include
"genwrap.h"
/* stricmp */
#include
"str_list.h"
#include
"str_list.h"
str_list_t
strListInit
()
str_list_t
strListInit
(
void
)
{
{
str_list_t
list
;
str_list_t
list
;
...
@@ -63,6 +63,21 @@ size_t strListCount(const str_list_t list)
...
@@ -63,6 +63,21 @@ size_t strListCount(const str_list_t list)
return
(
i
);
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
)
static
char
*
str_list_append
(
str_list_t
*
list
,
char
*
str
,
size_t
index
)
{
{
str_list_t
lp
;
str_list_t
lp
;
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/str_list.h
+
4
−
1
View file @
3bef9d40
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* @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 *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* 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);
...
@@ -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 */
/* Count the number of strings in the list and returns the count */
size_t
strListCount
(
const
str_list_t
);
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 */
/* Sort the strings in the string list */
void
strListSortAlpha
(
str_list_t
);
void
strListSortAlpha
(
str_list_t
);
void
strListSortAlphaReverse
(
str_list_t
);
void
strListSortAlphaReverse
(
str_list_t
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment