From 567cfbb96aaa2df44fe75a6cd17bdf0375421a15 Mon Sep 17 00:00:00 2001 From: leitner Date: Tue, 14 Jul 2020 19:49:39 +0000 Subject: [PATCH] fmt_copybytes and fmt_copybytes_sizeof_minus1 now follow the dest==NULL convention --- fmt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fmt.h b/fmt.h index 9b259d0..bbcc043 100644 --- a/fmt.h +++ b/fmt.h @@ -120,7 +120,7 @@ size_t fmt_strn(char *dest,const char *src,size_t limit) __pure__; /* copy n bytes from src to dest, return n */ static inline size_t fmt_copybytes(char* dest,const char* src,size_t n) { - byte_copy(dest,n,src); + if (dest) byte_copy(dest,n,src); return n; } @@ -130,7 +130,7 @@ static inline size_t fmt_copybytes(char* dest,const char* src,size_t n) { * since we are technically passing a string, sizeof will include the * finishing 0 byte which we neither need nor want */ static inline size_t fmt_copybytes_sizeof_minus1(char* dest,const char* src) { - byte_copy(dest,sizeof(src)-1,src); + if (dest) byte_copy(dest,sizeof(src)-1,src); return sizeof(src)-1; }