aslallocate.c (4b49587c3dd54aed8eb103d838a89ca79484a9b6) aslallocate.c (6f1f1a6395c91c5a845727d7313921a6fe3d297b)
1/******************************************************************************
2 *
3 * Module Name: aslallocate -- Local memory allocation
4 *
5 *****************************************************************************/
6
7/******************************************************************************
8 *

--- 172 unchanged lines hidden (view full) ---

181{
182 void *Allocated;
183
184
185 Allocated = ACPI_ALLOCATE_ZEROED (Size);
186 if (!Allocated)
187 {
188 AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
1/******************************************************************************
2 *
3 * Module Name: aslallocate -- Local memory allocation
4 *
5 *****************************************************************************/
6
7/******************************************************************************
8 *

--- 172 unchanged lines hidden (view full) ---

181{
182 void *Allocated;
183
184
185 Allocated = ACPI_ALLOCATE_ZEROED (Size);
186 if (!Allocated)
187 {
188 AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
189 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
190 Gbl_InputByteCount, Gbl_CurrentColumn,
191 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
189 AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber,
190 AslGbl_InputByteCount, AslGbl_CurrentColumn,
191 AslGbl_Files[ASL_FILE_INPUT].Filename, NULL);
192
193 CmCleanupAndExit ();
194 exit (1);
195 }
196
192
193 CmCleanupAndExit ();
194 exit (1);
195 }
196
197 TotalAllocations++;
198 TotalAllocated += Size;
197 AslGbl_TotalAllocations++;
198 AslGbl_TotalAllocated += Size;
199 return (Allocated);
200}
201
202
203/******************************************************************************
204 *
205 * FUNCTION: UtExpandLineBuffers
206 *
207 * PARAMETERS: None. Updates global line buffer pointers.
208 *
209 * RETURN: None. Reallocates the global line buffers
210 *
211 * DESCRIPTION: Called if the current line buffer becomes filled. Reallocates
199 return (Allocated);
200}
201
202
203/******************************************************************************
204 *
205 * FUNCTION: UtExpandLineBuffers
206 *
207 * PARAMETERS: None. Updates global line buffer pointers.
208 *
209 * RETURN: None. Reallocates the global line buffers
210 *
211 * DESCRIPTION: Called if the current line buffer becomes filled. Reallocates
212 * all global line buffers and updates Gbl_LineBufferSize. NOTE:
212 * all global line buffers and updates AslGbl_LineBufferSize. NOTE:
213 * Also used for the initial allocation of the buffers, when
214 * all of the buffer pointers are NULL. Initial allocations are
215 * of size ASL_DEFAULT_LINE_BUFFER_SIZE
216 *
217 *****************************************************************************/
218
219void
220UtExpandLineBuffers (
221 void)
222{
223 UINT32 NewSize;
224
225
226 /* Attempt to double the size of all line buffers */
227
213 * Also used for the initial allocation of the buffers, when
214 * all of the buffer pointers are NULL. Initial allocations are
215 * of size ASL_DEFAULT_LINE_BUFFER_SIZE
216 *
217 *****************************************************************************/
218
219void
220UtExpandLineBuffers (
221 void)
222{
223 UINT32 NewSize;
224
225
226 /* Attempt to double the size of all line buffers */
227
228 NewSize = Gbl_LineBufferSize * 2;
229 if (Gbl_CurrentLineBuffer)
228 NewSize = AslGbl_LineBufferSize * 2;
229 if (AslGbl_CurrentLineBuffer)
230 {
231 DbgPrint (ASL_DEBUG_OUTPUT,
232 "Increasing line buffer size from %u to %u\n",
230 {
231 DbgPrint (ASL_DEBUG_OUTPUT,
232 "Increasing line buffer size from %u to %u\n",
233 Gbl_LineBufferSize, NewSize);
233 AslGbl_LineBufferSize, NewSize);
234 }
235
234 }
235
236 UtReallocLineBuffers (&Gbl_CurrentLineBuffer, Gbl_LineBufferSize, NewSize);
237 UtReallocLineBuffers (&Gbl_MainTokenBuffer, Gbl_LineBufferSize, NewSize);
238 UtReallocLineBuffers (&Gbl_MacroTokenBuffer, Gbl_LineBufferSize, NewSize);
239 UtReallocLineBuffers (&Gbl_ExpressionTokenBuffer, Gbl_LineBufferSize, NewSize);
236 UtReallocLineBuffers (&AslGbl_CurrentLineBuffer, AslGbl_LineBufferSize, NewSize);
237 UtReallocLineBuffers (&AslGbl_MainTokenBuffer, AslGbl_LineBufferSize, NewSize);
238 UtReallocLineBuffers (&AslGbl_MacroTokenBuffer, AslGbl_LineBufferSize, NewSize);
239 UtReallocLineBuffers (&AslGbl_ExpressionTokenBuffer, AslGbl_LineBufferSize, NewSize);
240
240
241 Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
242 Gbl_LineBufferSize = NewSize;
241 AslGbl_LineBufPtr = AslGbl_CurrentLineBuffer;
242 AslGbl_LineBufferSize = NewSize;
243}
244
245
246/******************************************************************************
247 *
248 * FUNCTION: UtReallocLineBuffers
249 *
250 * PARAMETERS: Buffer - Buffer to realloc

--- 40 unchanged lines hidden (view full) ---

291 *
292 *****************************************************************************/
293
294void
295UtFreeLineBuffers (
296 void)
297{
298
243}
244
245
246/******************************************************************************
247 *
248 * FUNCTION: UtReallocLineBuffers
249 *
250 * PARAMETERS: Buffer - Buffer to realloc

--- 40 unchanged lines hidden (view full) ---

291 *
292 *****************************************************************************/
293
294void
295UtFreeLineBuffers (
296 void)
297{
298
299 free (Gbl_CurrentLineBuffer);
300 free (Gbl_MainTokenBuffer);
301 free (Gbl_MacroTokenBuffer);
302 free (Gbl_ExpressionTokenBuffer);
299 free (AslGbl_CurrentLineBuffer);
300 free (AslGbl_MainTokenBuffer);
301 free (AslGbl_MacroTokenBuffer);
302 free (AslGbl_ExpressionTokenBuffer);
303}
303}