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
cc32a99b
Commit
cc32a99b
authored
19 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Created strListInsertFile() - for use by iniReadFile() for !include'd files.
parent
1164252e
No related branches found
Branches containing commit
No related tags found
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
+22
-2
22 additions, 2 deletions
src/xpdev/str_list.c
src/xpdev/str_list.h
+1
-0
1 addition, 0 deletions
src/xpdev/str_list.h
with
23 additions
and
2 deletions
src/xpdev/str_list.c
+
22
−
2
View file @
cc32a99b
...
...
@@ -349,7 +349,7 @@ void strListFree(str_list_t* list)
}
}
str_list_t
str
L
ist
R
ead
F
ile
(
FILE
*
fp
,
str_list_t
*
lp
,
size_t
max_line_len
)
static
str_list_t
str
_l
ist
_r
ead
_f
ile
(
FILE
*
fp
,
str_list_t
*
lp
,
size_t
max_line_len
)
{
char
*
buf
=
NULL
;
size_t
count
;
...
...
@@ -364,7 +364,7 @@ str_list_t strListReadFile(FILE* fp, str_list_t* lp, size_t max_line_len)
lp
=&
list
;
}
count
=
strListCount
(
*
lp
);
count
=
strListCount
(
*
lp
);
while
(
!
feof
(
fp
))
{
if
(
buf
==
NULL
&&
(
buf
=
(
char
*
)
malloc
(
max_line_len
+
1
))
==
NULL
)
return
(
NULL
);
...
...
@@ -380,6 +380,26 @@ str_list_t strListReadFile(FILE* fp, str_list_t* lp, size_t max_line_len)
return
(
*
lp
);
}
size_t
strListInsertFile
(
FILE
*
fp
,
str_list_t
*
lp
,
size_t
index
,
size_t
max_line_len
)
{
str_list_t
list
;
size_t
count
;
if
((
list
=
str_list_read_file
(
fp
,
NULL
,
max_line_len
))
==
NULL
)
return
(
0
);
count
=
strListInsertList
(
lp
,
list
,
index
);
strListFree
(
&
list
);
return
(
count
);
}
str_list_t
strListReadFile
(
FILE
*
fp
,
str_list_t
*
lp
,
size_t
max_line_len
)
{
return
str_list_read_file
(
fp
,
lp
,
max_line_len
);
}
size_t
strListWriteFile
(
FILE
*
fp
,
const
str_list_t
list
,
const
char
*
separator
)
{
size_t
i
;
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/str_list.h
+
1
−
0
View file @
cc32a99b
...
...
@@ -124,6 +124,7 @@ void strListFreeBlock(char*);
/* Read lines from file appending each line to string list */
/* Pass NULL list to have list allocated for you */
str_list_t
strListReadFile
(
FILE
*
,
str_list_t
*
,
size_t
max_line_len
);
size_t
strListInsertFile
(
FILE
*
,
str_list_t
*
,
size_t
index
,
size_t
max_line_len
);
/* Write to file (fp) each string in the list, optionally separated by separator (e.g. "\n") */
size_t
strListWriteFile
(
FILE
*
,
const
str_list_t
,
const
char
*
separator
);
...
...
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