Merge branch develop-0.0

This commit is contained in:
liuwentan
2022-08-11 09:38:38 +08:00
87 changed files with 9132 additions and 522 deletions

View File

@@ -8,6 +8,26 @@
***********************************************************************************************
*/
#include <string.h>
#include "global_var.h"
struct stellar_engine g_engine_instance;
struct stellar_engine g_engine_instance;
int strncpy_safe(char *dst, const char *src, size_t dst_size)
{
if (nullptr == dst || nullptr == src || dst_size == 0) {
return -1;
}
size_t slen = strlen(src);
if (slen >= dst_size) {
strncpy(dst, src, dst_size);
dst[dst_size - 1] = '\0';
} else {
strcpy(dst, src);
dst[slen - 1] = '\0';
}
return 0;
}