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

Side by Side Diff: third_party/lzma_sdk/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/7zAlloc.h ('k') | third_party/lzma_sdk/7zBuf.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 7zAlloc.c */ 1 /* 7zAlloc.c -- Allocation functions
2 2010-10-29 : Igor Pavlov : Public domain */
2 3
3 #include <stdlib.h>
4 #include "7zAlloc.h" 4 #include "7zAlloc.h"
5 5
6 /* #define _SZ_ALLOC_DEBUG */ 6 /* #define _SZ_ALLOC_DEBUG */
7 /* use _SZ_ALLOC_DEBUG to debug alloc/free operations */ 7 /* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
8 8
9 #ifdef _SZ_ALLOC_DEBUG 9 #ifdef _SZ_ALLOC_DEBUG
10 10
11 #ifdef _WIN32 11 #ifdef _WIN32
12 #include <windows.h> 12 #include <windows.h>
13 #endif 13 #endif
14
14 #include <stdio.h> 15 #include <stdio.h>
15 int g_allocCount = 0; 16 int g_allocCount = 0;
16 int g_allocCountTemp = 0; 17 int g_allocCountTemp = 0;
18
17 #endif 19 #endif
18 20
19 void *SzAlloc(size_t size) 21 void *SzAlloc(void *p, size_t size)
20 { 22 {
23 p = p;
21 if (size == 0) 24 if (size == 0)
22 return 0; 25 return 0;
23 #ifdef _SZ_ALLOC_DEBUG 26 #ifdef _SZ_ALLOC_DEBUG
24 fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount); 27 fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount);
25 g_allocCount++; 28 g_allocCount++;
26 #endif 29 #endif
27 return malloc(size); 30 return malloc(size);
28 } 31 }
29 32
30 void SzFree(void *address) 33 void SzFree(void *p, void *address)
31 { 34 {
35 p = p;
32 #ifdef _SZ_ALLOC_DEBUG 36 #ifdef _SZ_ALLOC_DEBUG
33 if (address != 0) 37 if (address != 0)
34 { 38 {
35 g_allocCount--; 39 g_allocCount--;
36 fprintf(stderr, "\nFree; count = %10d", g_allocCount); 40 fprintf(stderr, "\nFree; count = %10d", g_allocCount);
37 } 41 }
38 #endif 42 #endif
39 free(address); 43 free(address);
40 } 44 }
41 45
42 void *SzAllocTemp(size_t size) 46 void *SzAllocTemp(void *p, size_t size)
43 { 47 {
48 p = p;
44 if (size == 0) 49 if (size == 0)
45 return 0; 50 return 0;
46 #ifdef _SZ_ALLOC_DEBUG 51 #ifdef _SZ_ALLOC_DEBUG
47 fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTe mp); 52 fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTe mp);
48 g_allocCountTemp++; 53 g_allocCountTemp++;
49 #ifdef _WIN32 54 #ifdef _WIN32
50 return HeapAlloc(GetProcessHeap(), 0, size); 55 return HeapAlloc(GetProcessHeap(), 0, size);
51 #endif 56 #endif
52 #endif 57 #endif
53 return malloc(size); 58 return malloc(size);
54 } 59 }
55 60
56 void SzFreeTemp(void *address) 61 void SzFreeTemp(void *p, void *address)
57 { 62 {
63 p = p;
58 #ifdef _SZ_ALLOC_DEBUG 64 #ifdef _SZ_ALLOC_DEBUG
59 if (address != 0) 65 if (address != 0)
60 { 66 {
61 g_allocCountTemp--; 67 g_allocCountTemp--;
62 fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp); 68 fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp);
63 } 69 }
64 #ifdef _WIN32 70 #ifdef _WIN32
65 HeapFree(GetProcessHeap(), 0, address); 71 HeapFree(GetProcessHeap(), 0, address);
66 return; 72 return;
67 #endif 73 #endif
68 #endif 74 #endif
69 free(address); 75 free(address);
70 } 76 }
OLDNEW
« no previous file with comments | « third_party/lzma_sdk/7zAlloc.h ('k') | third_party/lzma_sdk/7zBuf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698