OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
4 * | 4 * |
5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
9 * | 9 * |
10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 PL_ArenaCountInplaceGrowth(pool, size, incr); \ | 131 PL_ArenaCountInplaceGrowth(pool, size, incr); \ |
132 } else { \ | 132 } else { \ |
133 p = PL_ArenaGrow(pool, p, size, incr); \ | 133 p = PL_ArenaGrow(pool, p, size, incr); \ |
134 } \ | 134 } \ |
135 PL_ArenaCountGrowth(pool, size, incr); \ | 135 PL_ArenaCountGrowth(pool, size, incr); \ |
136 PR_END_MACRO | 136 PR_END_MACRO |
137 | 137 |
138 #define PL_ARENA_MARK(pool) ((void *) (pool)->current->avail) | 138 #define PL_ARENA_MARK(pool) ((void *) (pool)->current->avail) |
139 #define PR_UPTRDIFF(p,q) ((PRUword)(p) - (PRUword)(q)) | 139 #define PR_UPTRDIFF(p,q) ((PRUword)(p) - (PRUword)(q)) |
140 | 140 |
| 141 #define PL_CLEAR_UNUSED_PATTERN(a, pattern) \ |
| 142 (PR_ASSERT((a)->avail <= (a)->limit), \ |
| 143 memset((void*)(a)->avail, (pattern), (a)->limit - (a)->avail)) |
141 #ifdef DEBUG | 144 #ifdef DEBUG |
142 #define PL_FREE_PATTERN 0xDA | 145 #define PL_FREE_PATTERN 0xDA |
143 #define PL_CLEAR_UNUSED(a) (PR_ASSERT((a)->avail <= (a)->limit), \ | 146 #define PL_CLEAR_UNUSED(a) PL_CLEAR_UNUSED_PATTERN((a), PL_FREE_PATTERN) |
144 memset((void*)(a)->avail, PL_FREE_PATTERN, \ | |
145 (a)->limit - (a)->avail)) | |
146 #define PL_CLEAR_ARENA(a) memset((void*)(a), PL_FREE_PATTERN, \ | 147 #define PL_CLEAR_ARENA(a) memset((void*)(a), PL_FREE_PATTERN, \ |
147 (a)->limit - (PRUword)(a)) | 148 (a)->limit - (PRUword)(a)) |
148 #else | 149 #else |
149 #define PL_CLEAR_UNUSED(a) | 150 #define PL_CLEAR_UNUSED(a) |
150 #define PL_CLEAR_ARENA(a) | 151 #define PL_CLEAR_ARENA(a) |
151 #endif | 152 #endif |
152 | 153 |
153 #define PL_ARENA_RELEASE(pool, mark) \ | 154 #define PL_ARENA_RELEASE(pool, mark) \ |
154 PR_BEGIN_MACRO \ | 155 PR_BEGIN_MACRO \ |
155 char *_m = (char *)(mark); \ | 156 char *_m = (char *)(mark); \ |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 #define PL_ArenaCountInplaceGrowth(ap, size, incr) /* nothing */ | 205 #define PL_ArenaCountInplaceGrowth(ap, size, incr) /* nothing */ |
205 #define PL_ArenaCountGrowth(ap, size, incr) /* nothing */ | 206 #define PL_ArenaCountGrowth(ap, size, incr) /* nothing */ |
206 #define PL_ArenaCountRelease(ap, mark) /* nothing */ | 207 #define PL_ArenaCountRelease(ap, mark) /* nothing */ |
207 #define PL_ArenaCountRetract(ap, mark) /* nothing */ | 208 #define PL_ArenaCountRetract(ap, mark) /* nothing */ |
208 | 209 |
209 #endif /* !PL_ARENAMETER */ | 210 #endif /* !PL_ARENAMETER */ |
210 | 211 |
211 PR_END_EXTERN_C | 212 PR_END_EXTERN_C |
212 | 213 |
213 #endif /* plarena_h___ */ | 214 #endif /* plarena_h___ */ |
OLD | NEW |