diff options
author | Wayne Davison <wayned@users.sourceforge.net> | 2005-08-12 13:12:37 +0000 |
---|---|---|
committer | Wayne Davison <wayned@users.sourceforge.net> | 2005-08-12 13:12:37 +0000 |
commit | 6e9f6bc7d170c80ab2d3ca3dd6c093499c1e9936 (patch) | |
tree | 15203a90eb40e34a1dad4d9c17c464876c20196f | |
parent | 7f09a15a83ab868ece1b222cbab71d1456a413e2 (diff) | |
download | zsh-6e9f6bc7d170c80ab2d3ca3dd6c093499c1e9936.tar.gz zsh-6e9f6bc7d170c80ab2d3ca3dd6c093499c1e9936.tar.xz zsh-6e9f6bc7d170c80ab2d3ca3dd6c093499c1e9936.zip |
For gcc, use static inline functions in place of the ZS_str*
macros so that we get type-checking without pointer-signedness warnings.
-rw-r--r-- | Src/Zle/zle.h | 20 |
1 files changed, 16 insertions, 4 deletions
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 |