diff options
Diffstat (limited to 'tools/firmware-utils/src/utils.h')
-rw-r--r-- | tools/firmware-utils/src/utils.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/firmware-utils/src/utils.h b/tools/firmware-utils/src/utils.h new file mode 100644 index 0000000000..11ec740069 --- /dev/null +++ b/tools/firmware-utils/src/utils.h @@ -0,0 +1,11 @@ +#include <stdint.h> +#include <string.h> + +#pragma once + +#define FW_MEMCPY_STR(dst, src) \ + do { \ + size_t slen = strlen(src); \ + size_t dlen = sizeof(dst); \ + memcpy(dst, src, slen > dlen ? dlen : slen); \ + } while (0); |