mirror of
https://github.com/troglobit/libite.git
synced 2026-10-15 10:29:31 +00:00
Update code docs for string functions and macros as well
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
0a98f5bbd1
commit
970fa47ecf
12 files changed
+245
-63
No files matched your search
@@ -24,6 +24,13 @@
|
||||
* ==========================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file strndupa.h
|
||||
* @author William Ahern
|
||||
* @date 2009
|
||||
* @copyright MIT License
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
@@ -44,6 +51,12 @@ extern "C"
|
||||
#include <string.h> /* memcpy(3) */
|
||||
#include "strnlen.h"
|
||||
|
||||
/**
|
||||
* Duplicate part of string on stack
|
||||
* @param src string to duplicate
|
||||
* @param lim number of bytes to dupliate
|
||||
* @returns the result of memcpy(3)
|
||||
*/
|
||||
#define strndupa(src, lim) (__extension__ ({ \
|
||||
size_t len_ = strnlen(src, lim); \
|
||||
char *dst_ = __builtin_alloca(len_ + 1); \
|
||||
|
||||
Reference in new issue
Block a user