mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
util: Add xa{v}sprintf_append functions
Add variadic and va_list functions, xa{v}sprintf, which appends a formatted string to an existing string and re-allocate the string buffer if necessary. xasprintf becomes just a special case of xasprintf_append with a NULL starting string. Rather than looping to get a big enough buffer, simply the implementation by assuming we have a C99 compliant vsnprintf implementation to return the necessary size. A side effect is glibc 2.0 support is dropped which seems unnecessary. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
82a52ce457
commit
a1eff70c02
2 changed files with 41 additions and 21 deletions
2
util.h
2
util.h
|
@ -72,6 +72,8 @@ static inline void *xrealloc(void *p, size_t len)
|
|||
extern char *xstrdup(const char *s);
|
||||
|
||||
extern int PRINTF(2, 3) xasprintf(char **strp, const char *fmt, ...);
|
||||
extern int PRINTF(2, 3) xasprintf_append(char **strp, const char *fmt, ...);
|
||||
extern int xavsprintf_append(char **strp, const char *fmt, va_list ap);
|
||||
extern char *join_path(const char *path, const char *name);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue