Mercurial > mplayer.hg
annotate loader/wine/heap.h @ 31003:00825525514e
Replace memalign(x) (x > 8) by av_malloc() to prevent crashes on systems
lacking memalign(), e.g. Win32.
author | zuxy |
---|---|
date | Tue, 20 Apr 2010 04:33:00 +0000 |
parents | 9e739bdb049c |
children |
rev | line source |
---|---|
1 | 1 /* |
2 * Win32 heap definitions | |
3 * | |
4 * Copyright 1996 Alexandre Julliard | |
5 */ | |
6 | |
26045 | 7 #ifndef MPLAYER_HEAP_H |
8 #define MPLAYER_HEAP_H | |
1 | 9 |
10 #include "config.h" | |
11 | |
12 #include "winbase.h" | |
13 | |
14 extern HANDLE SystemHeap; | |
15 extern HANDLE SegptrHeap; | |
16 | |
28051 | 17 int HEAP_IsInsideHeap( HANDLE heap, DWORD flags, LPCVOID ptr ); |
18 SEGPTR HEAP_GetSegptr( HANDLE heap, DWORD flags, LPCVOID ptr ); | |
19 LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str ); | |
20 LPWSTR HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str ); | |
21 LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str ); | |
22 LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str ); | |
1 | 23 |
24 /* SEGPTR helper macros */ | |
25 | |
26 #define SEGPTR_ALLOC(size) \ | |
27 (HeapAlloc( SegptrHeap, 0, (size) )) | |
28 #define SEGPTR_NEW(type) \ | |
29 ((type *)HeapAlloc( SegptrHeap, 0, sizeof(type) )) | |
30 #define SEGPTR_STRDUP(str) \ | |
31 (HIWORD(str) ? HEAP_strdupA( SegptrHeap, 0, (str) ) : (LPSTR)(str)) | |
32 #define SEGPTR_STRDUP_WtoA(str) \ | |
33 (HIWORD(str) ? HEAP_strdupWtoA( SegptrHeap, 0, (str) ) : (LPSTR)(str)) | |
34 /* define an inline function, a macro won't do */ | |
35 static inline SEGPTR WINE_UNUSED SEGPTR_Get(LPCVOID ptr) { | |
26757
0fdf04b07ecb
cosmetics: Remove pointless parentheses from return statements.
diego
parents:
26045
diff
changeset
|
36 return HIWORD(ptr) ? HEAP_GetSegptr( SegptrHeap, 0, ptr ) : (SEGPTR)ptr; |
1 | 37 } |
38 #define SEGPTR_GET(ptr) SEGPTR_Get(ptr) | |
39 #define SEGPTR_FREE(ptr) \ | |
40 (HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0) | |
41 | |
42 /* system heap private data */ | |
43 /* you must lock the system heap before using this structure */ | |
44 typedef struct | |
45 { | |
46 void *gdi; /* GDI heap */ | |
47 void *user; /* USER handle table */ | |
48 void *cursor; /* cursor information */ | |
49 void *queue; /* message queues descriptor */ | |
50 void *win; /* windows descriptor */ | |
51 void *root; /* X11 root window */ | |
52 } SYSTEM_HEAP_DESCR; | |
53 | |
54 extern SYSTEM_HEAP_DESCR *SystemHeapDescr; | |
55 | |
26045 | 56 #endif /* MPLAYER_HEAP_H */ |