dragonmtn-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dragonmtn-commits] Changes to snowwhite/services.h


From: Mark Loeser
Subject: [Dragonmtn-commits] Changes to snowwhite/services.h
Date: Sun, 17 Apr 2005 02:17:40 -0400

Index: snowwhite/services.h
diff -u snowwhite/services.h:1.3 snowwhite/services.h:1.4
--- snowwhite/services.h:1.3    Sat Apr 16 21:29:44 2005
+++ snowwhite/services.h        Sun Apr 17 06:17:40 2005
@@ -8,7 +8,7 @@
  *
  * \wd \taz \greg \mysid
  *
- * $Id: services.h,v 1.3 2005/04/16 21:29:44 Halcy0n Exp $
+ * $Id: services.h,v 1.4 2005/04/17 06:17:40 Halcy0n Exp $
  */
 
 /*
@@ -73,7 +73,12 @@
 
 #include <netinet/in.h>
 
-#define FREE(x) do { free(x) ; (x) = NULL; } while (0)
+template <class T>
+inline void FREE(T *x)
+{
+       free(x);
+       x = NULL;
+}
 
 #include "options.h"
 #include "parse.h"
@@ -87,23 +92,29 @@
         (!(x) ? fatalSvsError(__FILE__, __LINE__, #x) : 0)
 #endif
 
-#ifndef MAX
 /**
- * \brief Macro that returns the highest value provided
+ * \brief Function that returns the highest value provided
  * \param x an integer
  * \param y an integer
  */
-#define MAX(x, y) (((x) > (y)) ? (x) : (y))
-#endif
+inline int MAX(int x, int y)
+{
+       if(x > y)
+               return x;
+       return y;
+}
 
-#ifndef MIN
 /**
  * \brief Macro that returns the lower value provided
  * \param x an integer
  * \param y an integer
  */
-#define MIN(x, y) ( ( (x) < (y) ) ? (x) : (y) )
-#endif
+inline int MIN(int x, int y)
+{
+       if(x > y)
+               return y;
+       return x;
+}
 
 /**
  * \brief Copy N bytes from source to target string but ensure \0 (NUL)
@@ -112,11 +123,11 @@
  * \param s_src Source character array
  * \param s_size Number bytes to copy
  */
-#define strncpyzt(s_dest, s_src, s_size)                               \
-do {                                                                   \
-       strncpy((s_dest), (s_src), (s_size));                           \
-       (s_dest)[(s_size) - 1] = '\0';                                  \
-} while(0)
+inline void strncpyzt(char *s_dest, const char *s_src, int s_size)
+{
+       strncpy(s_dest, s_src, s_size);
+       s_dest[s_size-1] = '\0';
+}
 
 /**
  * This is for the benefit of bigbrother, so it will know when to
@@ -136,15 +147,6 @@
 #endif
 
 /**
- * \bug This is a temporary hack...  Don't leave this in place long! [XXX Skan]
- */
-/// Temporary hack
-#define net_read(a,b,c)  read((a), (b), (c))
-
-/// Temporary hack
-#define net_write(a,b,c) write((a), (b), (c))
-
-/**
  * The number of services entries present -- this MUST be right or services
  * WILL have lots of problems
  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]