[PACKET_IO]format code style
This commit is contained in:
@@ -8,26 +8,6 @@
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "global_var.h"
|
||||
|
||||
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;
|
||||
}
|
||||
struct stellar_engine g_engine_instance;
|
||||
Reference in New Issue
Block a user