Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: third_party/lzma_sdk/Archive/7z/7zAlloc.c

Issue 10152012: Second attempt to update lzma_sdk to 9.20 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/lzma_sdk/Archive/7z/7zAlloc.h ('k') | third_party/lzma_sdk/Archive/7z/7zBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* 7zAlloc.c */
2
3 #include <stdlib.h>
4 #include "7zAlloc.h"
5
6 /* #define _SZ_ALLOC_DEBUG */
7 /* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
8
9 #ifdef _SZ_ALLOC_DEBUG
10
11 #ifdef _WIN32
12 #include <windows.h>
13 #endif
14 #include <stdio.h>
15 int g_allocCount = 0;
16 int g_allocCountTemp = 0;
17 #endif
18
19 void *SzAlloc(size_t size)
20 {
21 if (size == 0)
22 return 0;
23 #ifdef _SZ_ALLOC_DEBUG
24 fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount);
25 g_allocCount++;
26 #endif
27 return malloc(size);
28 }
29
30 void SzFree(void *address)
31 {
32 #ifdef _SZ_ALLOC_DEBUG
33 if (address != 0)
34 {
35 g_allocCount--;
36 fprintf(stderr, "\nFree; count = %10d", g_allocCount);
37 }
38 #endif
39 free(address);
40 }
41
42 void *SzAllocTemp(size_t size)
43 {
44 if (size == 0)
45 return 0;
46 #ifdef _SZ_ALLOC_DEBUG
47 fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTe mp);
48 g_allocCountTemp++;
49 #ifdef _WIN32
50 return HeapAlloc(GetProcessHeap(), 0, size);
51 #endif
52 #endif
53 return malloc(size);
54 }
55
56 void SzFreeTemp(void *address)
57 {
58 #ifdef _SZ_ALLOC_DEBUG
59 if (address != 0)
60 {
61 g_allocCountTemp--;
62 fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp);
63 }
64 #ifdef _WIN32
65 HeapFree(GetProcessHeap(), 0, address);
66 return;
67 #endif
68 #endif
69 free(address);
70 }
OLDNEW
« no previous file with comments | « third_party/lzma_sdk/Archive/7z/7zAlloc.h ('k') | third_party/lzma_sdk/Archive/7z/7zBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698