diff options
| author | lijia <[email protected]> | 2024-04-08 09:48:13 +0800 |
|---|---|---|
| committer | lijia <[email protected]> | 2024-04-08 09:48:13 +0800 |
| commit | 215e383be1f47cd18c235855d0cee0485f6cb423 (patch) | |
| tree | 34668fd59622c37826c3a786ba0e196a7d65147b /src/http_decoder_utils.c | |
| parent | ea795e9c6940281bf8557bfd79f13f319f947c58 (diff) | |
Separate from stellar-on-sapp project.
Diffstat (limited to 'src/http_decoder_utils.c')
| -rw-r--r-- | src/http_decoder_utils.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/http_decoder_utils.c b/src/http_decoder_utils.c new file mode 100644 index 0000000..a5dfbe1 --- /dev/null +++ b/src/http_decoder_utils.c @@ -0,0 +1,25 @@ +/* +********************************************************************************************** +* File: http_decoder_utils.c +* Description: +* Authors: LuWenPeng <[email protected]> +* Date: 2022-10-31 +* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved. +*********************************************************************************************** +*/ + +#include <string.h> + +#include "stellar/utils.h" + +char *safe_dup(const char *str, size_t len) +{ + if (str == NULL || len == 0) { + return NULL; + } + + char *dup = CALLOC(char, len + 1); + memcpy(dup, str, len); + + return dup; +}
\ No newline at end of file |
