]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - libratbox/include/ratbox_lib.h
SVN Id removal part two
[irc/rqf/shadowircd.git] / libratbox / include / ratbox_lib.h
index 02ec7d5f0f8721acf4172da5cf2bd562437b20e7..8a05962b4ef5ec9dd2114f7a0475d7e594b41342 100644 (file)
@@ -1,5 +1,4 @@
 /*
- * $Id: ratbox_lib.h 24866 2008-01-10 16:33:54Z androsyn $
  */
 
 #ifndef RB_LIB_H
@@ -38,50 +37,49 @@ char *alloca();
 
 #ifdef __GNUC__
 
-#ifdef likely
-#undef likely
+#ifdef rb_likely
+#undef rb_likely
 #endif
-#ifdef unlikely
-#undef unlikely
+#ifdef rb_unlikely
+#undef rb_unlikely
 #endif
 
 #if __GNUC__ == 2 && __GNUC_MINOR__ < 96
 # define __builtin_expect(x, expected_value) (x)
 #endif
 
-#define likely(x)       __builtin_expect(!!(x), 1)
-#define unlikely(x)     __builtin_expect(!!(x), 0)
+#define rb_likely(x)       __builtin_expect(!!(x), 1)
+#define rb_unlikely(x)     __builtin_expect(!!(x), 0)
 
 #else /* !__GNUC__ */
 
 #define UNUSED(x) x
 
-#ifdef likely
-#undef likely
+#ifdef rb_likely
+#undef rb_likely
 #endif
-#ifdef unlikely
-#undef unlikely
+#ifdef rb_unlikely
+#undef rb_unlikely
 #endif
-#define likely(x)      (x)
-#define unlikely(x)    (x)
+#define rb_likely(x)   (x)
+#define rb_unlikely(x) (x)
 #endif
 
 
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <process.h>
 
 #ifndef MAXPATHLEN
 #define MAXPATHLEN 128
 #endif
 
-
 #ifdef strerror
 #undef strerror
 #endif
 
-#define strerror(x) wsock_strerror(x)
-const char *wsock_strerror(int error);
+#define strerror(x) rb_strerror(x)
+char *rb_strerror(int error);
 
 
 #define ENOBUFS            WSAENOBUFS
@@ -96,18 +94,13 @@ const char *wsock_strerror(int error);
 #define pipe(x)  _pipe(x, 1024, O_BINARY)
 #define ioctl(x,y,z)  ioctlsocket(x,y, (u_long *)z)
 
-int setenv(const char *, const char *, int);
-int kill(int pid, int sig);
 #define WNOHANG 1
-pid_t waitpid(pid_t pid, int *status, int options);
-pid_t getpid(void);
-unsigned int geteuid(void);
 
 #ifndef SIGKILL
 #define SIGKILL SIGTERM
 #endif
 
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 
 
@@ -115,48 +108,44 @@ unsigned int geteuid(void);
 #define HOSTIPLEN      53
 #endif
 
-#ifdef SOFT_ASSERT
 #ifdef __GNUC__
-#define lrb_assert(expr)       do                                                              \
-                       if(unlikely(!(expr))) {                                                 \
-                               lib_ilog(L_MAIN,                                                \
+#define slrb_assert(expr)      do                                                              \
+                       if(rb_unlikely(!(expr))) {                                                      \
+                               rb_lib_log(                                             \
                                "file: %s line: %d (%s): Assertion failed: (%s)",       \
                                __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr);        \
-                               sendto_realops_flags(UMODE_ALL, L_ALL,                  \
-                               "file: %s line: %d (%s): Assertion failed: (%s)",       \
-                               __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr);        \
                        }                                                               \
                        while(0)
 #else
-#define lrb_assert(expr)       do                                                              \
-                       if(unlikely(!(expr))) {                                                 \
-                               lib_ilog(L_MAIN,                                                \
+#define slrb_assert(expr)      do                                                              \
+                       if(rb_unlikely(!(expr))) {                                                      \
+                               rb_lib_log(L_MAIN,                                              \
                                "file: %s line: %d: Assertion failed: (%s)",            \
                                __FILE__, __LINE__, #expr);                             \
-                               sendto_realops_flags(UMODE_ALL, L_ALL,                  \
-                               "file: %s line: %d: Assertion failed: (%s)"             \
-                               __FILE__, __LINE__, #expr);                             \
                        }                                                               \
                        while(0)
 #endif
+
+#ifdef SOFT_ASSERT
+#define lrb_assert(expr)       slrb_assert(expr)
 #else
-#define lrb_assert(expr)       assert(expr)
+#define lrb_assert(expr)       do { slrb_assert(expr); assert(expr); } while(0)
 #endif
 
-#ifdef SOCKADDR_IN_HAS_LEN
+#ifdef RB_SOCKADDR_HAS_SA_LEN
 #define ss_len sa_len
 #endif
 
-#define GET_SS_FAMILY(x) (((struct sockaddr *)(x))->sa_family)
-
-#ifdef SOCKADDR_IN_HAS_LEN
+#define GET_SS_FAMILY(x) (((const struct sockaddr *)(x))->sa_family)
+#define SET_SS_FAMILY(x, y) ((((struct sockaddr *)(x))->sa_family) = y)
+#ifdef RB_SOCKADDR_HAS_SA_LEN
 #define SET_SS_LEN(x, y)       do {                                                    \
                                        struct sockaddr *storage;               \
                                        storage = ((struct sockaddr *)(x));\
                                        storage->sa_len = (y);                          \
                                } while (0)
 #define GET_SS_LEN(x) (((struct sockaddr *)(x))->sa_len)
-#else /* !SOCKADDR_IN_HAS_LEN */
+#else /* !RB_SOCKADDR_HAS_SA_LEN */
 #define SET_SS_LEN(x, y) (((struct sockaddr *)(x))->sa_family = ((struct sockaddr *)(x))->sa_family)
 #ifdef RB_IPV6
 #define GET_SS_LEN(x) (((struct sockaddr *)(x))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6))
@@ -207,7 +196,14 @@ char *rb_crypt(const char *, const char *);
 
 unsigned char *rb_base64_encode(const unsigned char *str, int length);
 unsigned char *rb_base64_decode(const unsigned char *str, int length, int *ret);
+int rb_kill(pid_t, int);
+char *rb_strerror(int);
+
+int rb_setenv(const char *, const char *, int);
 
+pid_t rb_waitpid(pid_t pid, int *status, int options);
+pid_t rb_getpid(void);
+//unsigned int rb_geteuid(void);
 
 
 #include <rb_tools.h>