summaryrefslogtreecommitdiff
path: root/source/include/smb_macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/include/smb_macros.h')
-rw-r--r--source/include/smb_macros.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/source/include/smb_macros.h b/source/include/smb_macros.h
index 35ea792ebea..554dbbc0878 100644
--- a/source/include/smb_macros.h
+++ b/source/include/smb_macros.h
@@ -24,14 +24,6 @@
#ifndef _SMB_MACROS_H
#define _SMB_MACROS_H
-/* no ops to help reduce the diff between the current 3.0 and release branch */
-
-#define toupper_ascii(x) toupper(x)
-#define tolower_ascii(x) tolower(x)
-#define isupper_ascii(x) isupper(x)
-#define islower_ascii(x) islower(x)
-
-
/* Misc bit macros */
#define BOOLSTR(b) ((b) ? "Yes" : "No")
#define BITSETW(ptr,bit) ((SVAL(ptr,0) & (1<<(bit)))!=0)
@@ -84,6 +76,10 @@
(DEBUG(0,("PANIC: assert failed at %s(%d)\n", __FILE__, __LINE__))))
#endif
+#define SMB_WARN(condition, message) \
+ ((condition) ? (void)0 : \
+ DEBUG(0, ("WARNING: %s: %s\n", #condition, message)))
+
#define SMB_ASSERT_ARRAY(a,n) SMB_ASSERT((sizeof(a)/sizeof((a)[0])) >= (n))
/* these are useful macros for checking validity of handles */
@@ -279,8 +275,10 @@ copy an IP address from one buffer to another
*****************************************************************************/
#define SMB_MALLOC_ARRAY(type,count) (type *)malloc_array(sizeof(type),(count))
-#define SMB_REALLOC(p,s) Realloc((p),(s))
-#define SMB_REALLOC_ARRAY(p,type,count) (type *)realloc_array((p),sizeof(type),(count))
+#define SMB_REALLOC(p,s) Realloc((p),(s),True) /* Always frees p on error or s == 0 */
+#define SMB_REALLOC_KEEP_OLD_ON_ERROR(p,s) Realloc((p),(s),False) /* Never frees p on error or s == 0 */
+#define SMB_REALLOC_ARRAY(p,type,count) (type *)realloc_array((p),sizeof(type),(count),True) /* Always frees p on error or s == 0 */
+#define SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(p,type,count) (type *)realloc_array((p),sizeof(type),(count),False) /* Never frees p on error or s == 0 */
#define SMB_CALLOC_ARRAY(type,count) (type *)calloc_array(sizeof(type),(count))
#define SMB_XMALLOC_P(type) (type *)smb_xmalloc_array(sizeof(type),1)
#define SMB_XMALLOC_ARRAY(type,count) (type *)smb_xmalloc_array(sizeof(type),(count))