From: Enrico Scholz Date: Thu, 9 Oct 2003 23:05:42 +0000 (+0000) Subject: - added *_cast macros X-Git-Tag: VERSION_0_10~1284 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f28bde043c363169054e34c1e16a152ab24804b6;p=util-vserver.git - added *_cast macros - mark writeStr() as __attribute__((__unused__)) to prevent compiler warnings - fixed off-by-one error in WRITE_MSG git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@74 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/util-vserver/src/util.h b/util-vserver/src/util.h index ebf6ee0..4160259 100644 --- a/util-vserver/src/util.h +++ b/util-vserver/src/util.h @@ -19,6 +19,8 @@ #ifndef H_UTIL_VSERVER_SRC_UTIL_H #define H_UTIL_VSERVER_SRC_UTIL_H +#include "compat.h" + #include #include @@ -32,13 +34,25 @@ "the GNU General Public License. This program has absolutely no warranty.\n" #endif -inline static void +#ifndef __cplusplus +# define cAsT_(X) (X)) +# define reinterpret_cast(X) ((X) cAsT_ +# define static_cast(X) ((X) cAsT_ +# define const_cast(X) ((X) cAsT_ +#else /* __cplusplus */ +# define reinterpret_cast(X) reinterpret_cast +# define static_cast(X) static_cast +# define const_cast(X) const_cast +#endif + + +inline static void UNUSED writeStr(int fd, char const *cmd) { (void)write(fd, cmd, strlen(cmd)); } -#define WRITE_MSG(FD,X) (void)(write(FD,X,sizeof(X))) +#define WRITE_MSG(FD,X) (void)(write(FD,X,sizeof(X)-1)) #define WRITE_STR(FD,X) writeStr(FD,X) #endif // H_UTIL_VSERVER_SRC_UTIL_H