Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Icecast-Server
Commits
dabf9337
Commit
dabf9337
authored
Sep 14, 2018
by
Philipp Schafft
🦁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature: Added helper function replace_string()
parent
6c491b38
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
src/util.c
src/util.c
+21
-0
src/util.h
src/util.h
+2
-0
No files found.
src/util.c
View file @
dabf9337
...
...
@@ -1429,3 +1429,24 @@ int get_line(FILE *file, char *buf, size_t siz)
}
return
0
;
}
int
replace_string
(
char
**
dst
,
const
char
*
src
)
{
char
*
n
;
if
(
!
dst
)
return
-
1
;
if
(
src
)
{
n
=
strdup
(
src
);
if
(
!
n
)
return
-
1
;
}
else
{
n
=
NULL
;
}
free
(
*
dst
);
*
dst
=
n
;
return
0
;
}
src/util.h
View file @
dabf9337
...
...
@@ -128,4 +128,6 @@ struct tm *localtime_r(const time_t *timep, struct tm *result);
char
*
util_conv_string
(
const
char
*
string
,
const
char
*
in_charset
,
const
char
*
out_charset
);
int
get_line
(
FILE
*
file
,
char
*
buf
,
size_t
siz
);
int
replace_string
(
char
**
dst
,
const
char
*
src
);
#endif
/* __UTIL_H__ */
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