Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLAScommon
Commits
ff302030
Commit
ff302030
authored
Mar 26, 2019
by
Steffen Vogel
🎅🏼
Browse files
utils: replace str() and strv() macros by functions to avoid compiler warnings
parent
c2bbf77b
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/villas/utils.h
View file @
ff302030
...
...
@@ -196,9 +196,8 @@ char * strcatf(char **dest, const char *fmt, ...)
char
*
vstrcatf
(
char
**
dest
,
const
char
*
fmt
,
va_list
va
)
__attribute__
((
format
(
printf
,
2
,
0
)));
/** Format string like strcatf() just starting with empty string */
#define strf(fmt, ...) strcatf(&(char *) { NULL }, fmt, ##__VA_ARGS__)
#define vstrf(fmt, va) vstrcatf(&(char *) { NULL }, fmt, va)
char
*
strf
(
const
char
*
fmt
,
...);
char
*
vstrf
(
const
char
*
fmt
,
va_list
va
);
/** Allocate and initialize memory. */
void
*
alloc
(
size_t
bytes
);
...
...
lib/utils.c
View file @
ff302030
...
...
@@ -91,6 +91,27 @@ char * vstrcatf(char **dest, const char *fmt, va_list ap)
return
*
dest
;
}
char
*
strf
(
const
char
*
fmt
,
...)
{
char
*
buf
=
NULL
;
va_list
ap
;
va_start
(
ap
,
fmt
);
vstrcatf
(
&
buf
,
fmt
,
ap
);
va_end
(
ap
);
return
buf
;
}
char
*
vstrf
(
const
char
*
fmt
,
va_list
va
)
{
char
*
buf
=
NULL
;
vstrcatf
(
&
buf
,
fmt
,
va
);
return
buf
;
}
void
*
alloc
(
size_t
bytes
)
{
void
*
p
=
malloc
(
bytes
);
...
...
Write
Preview
Supports
Markdown
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