diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-05 17:56:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-05 19:37:54 +0300 |
commit | 3a864f5ee45be69bef9e232f5d8e4a1dfc624b1e (patch) | |
tree | 006ec05860dd12238c36ae0acb9eb920f903823d /source/blender/blenlib/BLI_string_utf8.h | |
parent | 9b8a92b874d30657753d9714d65ec6f16478c2ed (diff) |
BLI_string_utf8: macros that de-duplicate sizeof arg
Diffstat (limited to 'source/blender/blenlib/BLI_string_utf8.h')
-rw-r--r-- | source/blender/blenlib/BLI_string_utf8.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h index 32504a88b48..21542d0d6e1 100644 --- a/source/blender/blenlib/BLI_string_utf8.h +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -77,6 +77,16 @@ size_t BLI_str_partition_ex_utf8( #define BLI_UTF8_WIDTH_MAX 2 /* columns */ #define BLI_UTF8_ERR ((unsigned int)-1) +/** \name String Copy/Format Macros + * Avoid repeating destination with `sizeof(..)`. + * \note `ARRAY_SIZE` allows pointers on some platforms. + * \{ */ +#define STRNCPY_UTF8(dst, src) \ + BLI_strncpy_utf8(dst, src, ARRAY_SIZE(dst)) +#define STRNCPY_UTF8_RLEN(dst, src) \ + BLI_strncpy_utf8_rlen(dst, src, ARRAY_SIZE(dst)) +/** \} */ + #ifdef __cplusplus } #endif |