mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
util: introduce xstrndup helper
We already have xstrdup, add xstrndup as well to make it straight-forward to clone part of a string. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
This commit is contained in:
parent
4048aed12b
commit
651410e54c
2 changed files with 12 additions and 0 deletions
1
util.h
1
util.h
|
@ -61,6 +61,7 @@ static inline void *xrealloc(void *p, size_t len)
|
|||
}
|
||||
|
||||
extern char *xstrdup(const char *s);
|
||||
extern char *xstrndup(const char *s, size_t len);
|
||||
|
||||
extern int PRINTF(2, 3) xasprintf(char **strp, const char *fmt, ...);
|
||||
extern int PRINTF(2, 3) xasprintf_append(char **strp, const char *fmt, ...);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue