diff options
author | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2009-01-24 00:29:50 +0000 |
---|---|---|
committer | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2009-01-24 00:29:50 +0000 |
commit | be94a568ef65120465b49f5c6db90cd4ec3c3eb2 (patch) | |
tree | fe7fc014fe1053e821860c53f78e4cabb95b9ac7 /Plugins/utils/mir_memory.h | |
parent | 52e0dac49837ca1123412fccd95fdb95873c8321 (diff) |
utils: sync with BerliOS
git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@132 c086bb3d-8645-0410-b8da-73a8550f86e7
Diffstat (limited to 'Plugins/utils/mir_memory.h')
-rw-r--r-- | Plugins/utils/mir_memory.h | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/Plugins/utils/mir_memory.h b/Plugins/utils/mir_memory.h index 52440ae..b3f32fc 100644 --- a/Plugins/utils/mir_memory.h +++ b/Plugins/utils/mir_memory.h @@ -21,19 +21,52 @@ Boston, MA 02111-1307, USA. #ifndef __MIR_MEMORY_H__
# define __MIR_MEMORY_H__
+
#include <windows.h>
-// Need to be called on ME_SYSTEM_MODULESLOADED or Load
-void init_mir_malloc();
+static BOOL mir_is_unicode()
+{
+ char ver[1024];
+ CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM) sizeof(ver), (LPARAM) ver);
+ return strstr(ver, "Unicode") != NULL;
+}
+
+
+static void * mir_alloc0(size_t size)
+{
+ void * ptr = mir_alloc(size);
+
+ if (ptr != NULL)
+ memset(ptr, 0, size);
+
+ return ptr;
+}
+
+static int strcmpnull(char *str1, char *str2)
+{
+ if ( str1 == NULL && str2 == NULL )
+ return 0;
+ if ( str1 != NULL && str2 == NULL )
+ return 1;
+ if ( str1 == NULL && str2 != NULL )
+ return -1;
-BOOL mir_is_unicode();
+ return strcmp(str1, str2);
+}
+static int strcmpnullW(WCHAR *str1, WCHAR *str2)
+{
+ if ( str1 == NULL && str2 == NULL )
+ return 0;
+ if ( str1 != NULL && str2 == NULL )
+ return 1;
+ if ( str1 == NULL && str2 != NULL )
+ return -1;
-void * mir_alloc0(size_t size);
-int strcmpnull(char *str1, char *str2);
-int strcmpnullW(WCHAR *str1, WCHAR *str2);
+ return lstrcmpW(str1, str2);
+}
#ifdef UNICODE
|