aboutsummaryrefslogtreecommitdiff
path: root/source/compiler/aslutils.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2015-02-05 00:09:52 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2015-02-05 00:09:52 +0000
commit2872953d4a9c9c4e0fc0b9ab37d0e962909625a0 (patch)
treed125aa97a34ea51a7841c57256f738956bc3de3d /source/compiler/aslutils.c
parente8991236d498c9646c20a8acf0236cf3342dad6f (diff)
downloadsrc-2872953d4a9c9c4e0fc0b9ab37d0e962909625a0.tar.gz
src-2872953d4a9c9c4e0fc0b9ab37d0e962909625a0.zip
Import ACPICA 20150204.vendor/acpica/20150204
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=278226 svn path=/vendor-sys/acpica/20150204/; revision=278227; tag=vendor/acpica/20150204
Diffstat (limited to 'source/compiler/aslutils.c')
-rw-r--r--source/compiler/aslutils.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c
index c9a9fac6d75d..519afbc04bf6 100644
--- a/source/compiler/aslutils.c
+++ b/source/compiler/aslutils.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2014, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -571,20 +571,36 @@ UtStringCacheCalloc (
{
char *Buffer;
ASL_CACHE_INFO *Cache;
+ UINT32 CacheSize = ASL_STRING_CACHE_SIZE;
- if (Length > ASL_STRING_CACHE_SIZE)
+ if (Length > CacheSize)
{
- Buffer = UtLocalCalloc (Length);
- return (Buffer);
+ CacheSize = Length;
+
+ if (Gbl_StringCacheList)
+ {
+ Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize);
+
+ /* Link new cache buffer just following head of list */
+
+ Cache->Next = Gbl_StringCacheList->Next;
+ Gbl_StringCacheList->Next = Cache;
+
+ /* Leave cache management pointers alone as they pertain to head */
+
+ Gbl_StringCount++;
+ Gbl_StringSize += Length;
+
+ return (Cache->Buffer);
+ }
}
if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast)
{
/* Allocate a new buffer */
- Cache = UtLocalCalloc (sizeof (Cache->Next) +
- ASL_STRING_CACHE_SIZE);
+ Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize);
/* Link new cache buffer to head of list */
@@ -594,7 +610,7 @@ UtStringCacheCalloc (
/* Setup cache management pointers */
Gbl_StringCacheNext = Cache->Buffer;
- Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE;
+ Gbl_StringCacheLast = Gbl_StringCacheNext + CacheSize;
}
Gbl_StringCount++;