From e350502cd038577441ef483ed10dcd1d4b40ac8f Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 26 Mar 2012 22:05:38 +0000 Subject: [PATCH] Add "static inline" helper function "Bstrncpyz" to compat.h. git-svn-id: https://svn.eduke32.com/eduke32@2550 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/compat.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/polymer/eduke32/build/include/compat.h b/polymer/eduke32/build/include/compat.h index 945c309ed..9b0c3b544 100644 --- a/polymer/eduke32/build/include/compat.h +++ b/polymer/eduke32/build/include/compat.h @@ -431,6 +431,13 @@ int32_t Bclosedir(BDIR *dir); typedef int32_t bssize_t; #endif +static inline char *Bstrncpyz(char *dst, const char *src, bsize_t n) +{ + strncpy(dst, src, n); + dst[n-1] = 0; + return dst; +} + #if RAND_MAX == 32767 static inline uint16_t system_15bit_rand(void) { return (uint16_t)rand(); } #else // RAND_MAX > 32767, assumed to be of the form 2^k - 1