diff options
author | jkim <jkim@FreeBSD.org> | 2015-02-18 20:33:00 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2015-02-18 20:33:00 +0000 |
commit | a1a0103e5c0491f9378743fd890ce7c1b5731996 (patch) | |
tree | fb0545399f40531160cc35b45423b4a49e6dbb79 /sys/contrib/dev/acpica/compiler/aslutils.c | |
parent | e88977434bd97898228c4330df94ca93ffd4b3bf (diff) | |
parent | c289b811b42daf9e7ef5c37a35e951d01c23715a (diff) | |
download | FreeBSD-src-a1a0103e5c0491f9378743fd890ce7c1b5731996.zip FreeBSD-src-a1a0103e5c0491f9378743fd890ce7c1b5731996.tar.gz |
Merge ACPICA 20141107 and 20150204.
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/aslutils.c')
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslutils.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index 0ec4473..7258daa 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/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++; |