diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/string.h | 19 | ||||
| -rw-r--r-- | include/stdio_dev.h | 1 |
2 files changed, 16 insertions, 4 deletions
diff --git a/include/linux/string.h b/include/linux/string.h index a8a6cf4af50..850356d7c3f 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -101,12 +101,12 @@ size_t strcspn(const char *s, const char *reject); # define strndup sandbox_strndup #endif -#ifndef __HAVE_ARCH_STRDUP extern char * strdup(const char *); extern char * strndup(const char *, size_t); + extern const char *strdup_const(const char *s); extern void kfree_const(const void *x); -#endif + #ifndef __HAVE_ARCH_STRSWAB extern char * strswab(const char *); #endif @@ -144,7 +144,20 @@ void *memchr_inv(const void *, int, size_t); * memory is available * */ -char *memdup(const void *src, size_t len); +void *memdup(const void *src, size_t len); + +/** + * memdup_nul() - allocate a buffer and copy in the contents, appending a nul byte + * + * Note that this returns a valid pointer even if @len is 0 + * + * @src: data to copy in + * @len: number of bytes to copy + * Return: allocated buffer with the copied contents and an extra nul byte, + * or NULL if not enough memory is available + * + */ +void *memdup_nul(const void *src, size_t len); unsigned long ustrtoul(const char *cp, char **endp, unsigned int base); unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base); diff --git a/include/stdio_dev.h b/include/stdio_dev.h index f7f9c10199e..d93604331ff 100644 --- a/include/stdio_dev.h +++ b/include/stdio_dev.h @@ -96,7 +96,6 @@ int stdio_add_devices(void); int stdio_deregister_dev(struct stdio_dev *dev, int force); struct list_head *stdio_get_list(void); struct stdio_dev *stdio_get_by_name(const char *name); -struct stdio_dev *stdio_clone(struct stdio_dev *dev); int drv_lcd_init(void); int drv_video_init(void); |
