Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jean-Baptiste Kempf
libaacs
Commits
c6dc792e
Commit
c6dc792e
authored
May 29, 2015
by
npzacs
Browse files
Merge string utils changes from other libs
parent
d9056967
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/util/strutl.c
View file @
c6dc792e
...
...
@@ -18,6 +18,10 @@
* <http://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include "strutl.h"
#include "macro.h"
...
...
@@ -155,7 +159,16 @@ int hex_array_to_hexstring(char *str, const uint8_t *hex_array, uint32_t size)
char
*
str_dup
(
const
char
*
str
)
{
return
str
?
strcpy
(
malloc
(
strlen
(
str
)
+
1
),
str
)
:
NULL
;
char
*
dup
=
NULL
;
if
(
str
)
{
size_t
size
=
strlen
(
str
)
+
1
;
dup
=
malloc
(
size
);
if
(
dup
)
{
memcpy
(
dup
,
str
,
size
);
}
}
return
dup
;
}
char
*
str_printf
(
const
char
*
fmt
,
...)
...
...
@@ -198,7 +211,7 @@ const char *str_next_line(const char *p)
while
(
*
p
&&
*
p
!=
'\r'
&&
*
p
!=
'\n'
)
{
p
++
;
}
while
(
*
p
&&
(
*
p
==
'\r'
||
*
p
==
'\n'
))
{
while
(
*
p
&&
(
*
p
==
'\r'
||
*
p
==
'\n'
||
*
p
==
' '
))
{
p
++
;
}
...
...
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