Move ABS() to libutil.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 1 Nov 2008 19:44:12 +0000 (20:44 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 1 Nov 2008 19:44:12 +0000 (20:44 +0100)
lib/util/util.h
source3/include/smb_macros.h

index 0f09747a3ad4111559c7b13f7b8ff5c87b11948d..ec1cfef110a21bd8e0fa6820b9395f57d759e6ff 100644 (file)
@@ -67,6 +67,10 @@ size_t valgrind_strlen(const char *s);
 #endif
 #endif
 
+#ifndef ABS
+#define ABS(a) ((a)>0?(a):(-(a)))
+#endif
+
 #include "../lib/util/memory.h"
 
 /**
index 668dc186d3ac77be7222c8c4d6d5482b10ce3b70..b8e087362a6a6b792c50060f64cbfaa5cad95def 100644 (file)
 #define IS_DOS_SYSTEM(test_mode)   (((test_mode) & aSYSTEM) != 0)
 #define IS_DOS_HIDDEN(test_mode)   (((test_mode) & aHIDDEN) != 0)
 
-#ifndef SAFE_FREE /* Oh no this is also defined in tdb.h */
-
-/**
- * Free memory if the pointer and zero the pointer.
- *
- * @note You are explicitly allowed to pass NULL pointers -- they will
- * always be ignored.
- **/
-#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
-#endif
-
-
-
 #define SMB_WARN(condition, message) \
     ((condition) ? (void)0 : \
      DEBUG(0, ("WARNING: %s: %s\n", #condition, message)))
 #define VALID_STAT_OF_DIR(st) (VALID_STAT(st) && S_ISDIR((st).st_mode))
 #define SET_STAT_INVALID(st) ((st).st_nlink = 0)
 
-#ifndef MIN
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#endif
-#ifndef MAX
-#define MAX(a,b) ((a)>(b)?(a):(b))
-#endif
-
-#ifndef ABS
-#define ABS(a) ((a)>0?(a):(-(a)))
-#endif
-
 /* Macros to get at offsets within smb_lkrng and smb_unlkrng
    structures. We cannot define these as actual structures
    due to possible differences in structure packing