From 6e9f6bc7d170c80ab2d3ca3dd6c093499c1e9936 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 12 Aug 2005 13:12:37 +0000 Subject: For gcc, use static inline functions in place of the ZS_str* macros so that we get type-checking without pointer-signedness warnings. --- Src/Zle/zle.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'Src/Zle/zle.h') diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h index ff4d81b47..bbe3aeef3 100644 --- a/Src/Zle/zle.h +++ b/Src/Zle/zle.h @@ -89,10 +89,22 @@ typedef int ZLE_INT_T; #define ZS_memmove memmove #define ZS_memset memset #define ZS_memcmp memcmp -#define ZS_strlen strlen -#define ZS_strcpy strcpy -#define ZS_strncpy strncpy -#define ZS_strncmp strncmp + +#ifdef __GNUC__ +static inline size_t ZS_strlen(ZLE_STRING_T s) +{ return strlen((char*)s); } +static inline ZLE_STRING_T ZS_strcpy(ZLE_STRING_T t, ZLE_STRING_T f) +{ return (ZLE_STRING_T)strcpy((char*)t, (char*)f); } +static inline ZLE_STRING_T ZS_strncpy(ZLE_STRING_T t, ZLE_STRING_T f, size_t l) +{ return (ZLE_STRING_T)strncpy((char*)t, (char*)f, l); } +static inline int ZS_strncmp(ZLE_STRING_T s1, ZLE_STRING_T s2, size_t l) +{ return strncmp((char*)s1, (char*)s2, l); } +#else +#define ZS_strlen(s) strlen((char*)(s)) +#define ZS_strcpy(t,f) strcpy((char*)(t),(char*)(f)) +#define ZS_strncpy(t,f,l) strncpy((char*)(t),(char*)(f),(l)) +#define ZS_strncmp(s1,s2,l) strncmp((char*)(s1),(char*)(s2),(l)) +#endif #define ZC_iblank iblank #define ZC_icntrl icntrl -- cgit 1.4.1