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

Side by Side Diff: third_party/lzma_sdk/C/7zAlloc.c

Issue 6730044: Upgrading lzma_sdk to version 9.20. Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 9 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/C/7zAlloc.h ('k') | third_party/lzma_sdk/C/7zBuf.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /* 7zAlloc.c -- Allocation functions
2 2010-10-29 : Igor Pavlov : Public domain */
3
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
15 #include <stdio.h>
16 int g_allocCount = 0;
17 int g_allocCountTemp = 0;
18
19 #endif
20
21 void *SzAlloc(void *p, size_t size)
22 {
23 p = p;
24 if (size == 0)
25 return 0;
26 #ifdef _SZ_ALLOC_DEBUG
27 fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount);
28 g_allocCount++;
29 #endif
30 return malloc(size);
31 }
32
33 void SzFree(void *p, void *address)
34 {
35 p = p;
36 #ifdef _SZ_ALLOC_DEBUG
37 if (address != 0)
38 {
39 g_allocCount--;
40 fprintf(stderr, "\nFree; count = %10d", g_allocCount);
41 }
42 #endif
43 free(address);
44 }
45
46 void *SzAllocTemp(void *p, size_t size)
47 {
48 p = p;
49 if (size == 0)
50 return 0;
51 #ifdef _SZ_ALLOC_DEBUG
52 fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTe mp);
53 g_allocCountTemp++;
54 #ifdef _WIN32
55 return HeapAlloc(GetProcessHeap(), 0, size);
56 #endif
57 #endif
58 return malloc(size);
59 }
60
61 void SzFreeTemp(void *p, void *address)
62 {
63 p = p;
64 #ifdef _SZ_ALLOC_DEBUG
65 if (address != 0)
66 {
67 g_allocCountTemp--;
68 fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp);
69 }
70 #ifdef _WIN32
71 HeapFree(GetProcessHeap(), 0, address);
72 return;
73 #endif
74 #endif
75 free(address);
76 }
OLDNEW
« no previous file with comments | « third_party/lzma_sdk/C/7zAlloc.h ('k') | third_party/lzma_sdk/C/7zBuf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698