winefile temporary allocations
Martin Fuchs
martin-fuchs at gmx.net
Fri May 13 04:51:36 CDT 2005
Changelog
use macros for platform dependent temporary allocations
Index: winefile.c
===================================================================
RCS file: /home/wine/wine/programs/winefile/winefile.c,v
retrieving revision 1.34
diff -u -p -d -r1.34 winefile.c
--- winefile.c 11 May 2005 18:23:30 -0000 1.34
+++ winefile.c 13 May 2005 09:06:01 -0000
@@ -21,6 +21,12 @@
#ifdef __WINE__
#include "config.h"
#include "wine/port.h"
+
+#define TMP_ALLOC(s) HeapAlloc(GetProcessHeap(), 0, s)
+#define TMP_FREE(p) HeapFree(GetProcessHeap(), 0, p)
+#else
+#define TMP_ALLOC(s) alloca(s)
+#define TMP_FREE(p)
#endif
#include <locale.h>
@@ -1161,7 +1167,7 @@ static void SortDirectory(Entry* dir, SO
len++;
if (len) {
- array = HeapAlloc(GetProcessHeap(), 0, len*sizeof(Entry*));
+ array = (Entry**) TMP_ALLOC(len*sizeof(Entry*));
p = array;
for(entry=dir->down; entry; entry=entry->next)
@@ -1176,7 +1182,8 @@ static void SortDirectory(Entry* dir, SO
p[0]->next = p[1];
(*p)->next = 0;
- HeapFree( GetProcessHeap(), 0, array );
+
+ TMP_FREE(array);
}
}
More information about the wine-patches
mailing list