本文整理汇总了C++中UtLocalCalloc函数的典型用法代码示例。如果您正苦于以下问题:C++ UtLocalCalloc函数的具体用法?C++ UtLocalCalloc怎么用?C++ UtLocalCalloc使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UtLocalCalloc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrSetLineNumber
void
PrSetLineNumber (
UINT32 OriginalLineNumber,
UINT32 PreprocessorLineNumber)
{
UINT32 Entry;
PR_LINE_MAPPING *Block;
UINT32 Index;
UINT32 i;
Entry = PreprocessorLineNumber / PR_LINES_PER_BLOCK;
Index = PreprocessorLineNumber % PR_LINES_PER_BLOCK;
Block = Gbl_MapBlockHead;
for (i = 0; i < Entry; i++)
{
/* Allocate new mapping blocks as necessary */
if (!Block->Next)
{
Block->Next = UtLocalCalloc (sizeof (PR_LINE_MAPPING));
Block->Next->Map = UtLocalCalloc (PR_LINES_PER_BLOCK * sizeof (UINT32));
}
Block = Block->Next;
}
Block->Map[Index] = OriginalLineNumber;
}
示例2: UtStringCacheCalloc
char *
UtStringCacheCalloc (
UINT32 Length)
{
char *Buffer;
ASL_CACHE_INFO *Cache;
UINT32 CacheSize = ASL_STRING_CACHE_SIZE;
if (Length > CacheSize)
{
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) + CacheSize);
/* Link new cache buffer to head of list */
Cache->Next = Gbl_StringCacheList;
Gbl_StringCacheList = Cache;
/* Setup cache management pointers */
Gbl_StringCacheNext = Cache->Buffer;
Gbl_StringCacheLast = Gbl_StringCacheNext + CacheSize;
}
Gbl_StringCount++;
Gbl_StringSize += Length;
Buffer = Gbl_StringCacheNext;
Gbl_StringCacheNext += Length;
return (Buffer);
}
示例3: DtWriteTableToListing
void
DtWriteTableToListing (
void)
{
UINT8 *Buffer;
if (!Gbl_ListingFlag)
{
return;
}
/* Read the entire table from the output file */
Buffer = UtLocalCalloc (Gbl_TableLength);
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
FlReadFile (ASL_FILE_AML_OUTPUT, Buffer, Gbl_TableLength);
/* Dump the raw table data */
AcpiOsRedirectOutput (Gbl_Files[ASL_FILE_LISTING_OUTPUT].Handle);
AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
ACPI_RAW_TABLE_DATA_HEADER, Gbl_TableLength, Gbl_TableLength);
AcpiUtDumpBuffer2 (Buffer, Gbl_TableLength, DB_BYTE_DISPLAY);
AcpiOsRedirectOutput (stdout);
}
示例4: UtFieldCacheCalloc
DT_FIELD *
UtFieldCacheCalloc (
void)
{
ASL_CACHE_INFO *Cache;
if (Gbl_FieldCacheNext >= Gbl_FieldCacheLast)
{
/* Allocate a new buffer */
Cache = UtLocalCalloc (sizeof (Cache->Next) +
(sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE));
/* Link new cache buffer to head of list */
Cache->Next = Gbl_FieldCacheList;
Gbl_FieldCacheList = Cache;
/* Setup cache management pointers */
Gbl_FieldCacheNext = ACPI_CAST_PTR (DT_FIELD, Cache->Buffer);
Gbl_FieldCacheLast = Gbl_FieldCacheNext + ASL_FIELD_CACHE_SIZE;
}
Gbl_FieldCount++;
return (Gbl_FieldCacheNext++);
}
示例5: TrGetNextNode
static ACPI_PARSE_OBJECT *
TrGetNextNode (
void)
{
ASL_CACHE_INFO *Cache;
if (Gbl_ParseOpCacheNext >= Gbl_ParseOpCacheLast)
{
/* Allocate a new buffer */
Cache = UtLocalCalloc (sizeof (Cache->Next) +
(sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE));
/* Link new cache buffer to head of list */
Cache->Next = Gbl_ParseOpCacheList;
Gbl_ParseOpCacheList = Cache;
/* Setup cache management pointers */
Gbl_ParseOpCacheNext = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Cache->Buffer);
Gbl_ParseOpCacheLast = Gbl_ParseOpCacheNext + ASL_PARSEOP_CACHE_SIZE;
}
Gbl_ParseOpCount++;
return (Gbl_ParseOpCacheNext++);
}
示例6: PrPushInputFileStack
void
PrPushInputFileStack (
FILE *InputFile,
char *Filename)
{
PR_FILE_NODE *Fnode;
/* Save the current state in an Fnode */
Fnode = UtLocalCalloc (sizeof (PR_FILE_NODE));
Fnode->File = Gbl_Files[ASL_FILE_INPUT].Handle;
Fnode->Next = Gbl_InputFileList;
Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
Fnode->CurrentLineNumber = Gbl_CurrentLineNumber;
/* Push it on the stack */
Gbl_InputFileList = Fnode;
DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID
"Push InputFile Stack, returning %p\n\n",
Gbl_CurrentLineNumber, InputFile);
/* Reset the global line count and filename */
Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
Gbl_Files[ASL_FILE_INPUT].Handle = InputFile;
Gbl_CurrentLineNumber = 1;
}
示例7: DtCompileFacs
ACPI_STATUS
DtCompileFacs (
DT_FIELD **PFieldList)
{
DT_SUBTABLE *Subtable;
UINT8 *ReservedBuffer;
ACPI_STATUS Status;
UINT32 ReservedSize;
Status = DtCompileTable (PFieldList, AcpiDmTableInfoFacs,
&Gbl_RootTable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Large FACS reserved area at the end of the table */
ReservedSize = (UINT32) sizeof (((ACPI_TABLE_FACS *) NULL)->Reserved1);
ReservedBuffer = UtLocalCalloc (ReservedSize);
DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable);
ACPI_FREE (ReservedBuffer);
DtInsertSubtable (Gbl_RootTable, Subtable);
return (AE_OK);
}
示例8: RsAllocateResourceNode
ASL_RESOURCE_NODE *
RsAllocateResourceNode (
UINT32 Size)
{
ASL_RESOURCE_NODE *Rnode;
/* Allocate the node */
Rnode = UtLocalCalloc (sizeof (ASL_RESOURCE_NODE));
/* Allocate the resource descriptor itself */
Rnode->Buffer = UtLocalCalloc (Size);
Rnode->BufferLength = Size;
return (Rnode);
}
示例9: DtCreateSubtable
void
DtCreateSubtable (
UINT8 *Buffer,
UINT32 Length,
DT_SUBTABLE **RetSubtable)
{
DT_SUBTABLE *Subtable;
Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE));
/* Create a new buffer for the subtable data */
Subtable->Buffer = UtLocalCalloc (Length);
ACPI_MEMCPY (Subtable->Buffer, Buffer, Length);
Subtable->Length = Length;
Subtable->TotalLength = Length;
*RetSubtable = Subtable;
}
示例10: DtNormalizeBuffer
static char *
DtNormalizeBuffer (
char *Buffer,
UINT32 *Count)
{
char *NewBuffer;
char *TmpBuffer;
UINT32 BufferCount = 0;
BOOLEAN Separator = TRUE;
char c;
NewBuffer = UtLocalCalloc (ACPI_STRLEN (Buffer) + 1);
TmpBuffer = NewBuffer;
while ((c = *Buffer++))
{
switch (c)
{
/* Valid separators */
case '[':
case ']':
case ' ':
case ',':
Separator = TRUE;
break;
default:
if (Separator)
{
/* Insert blank as the standard separator */
if (NewBuffer[0])
{
*TmpBuffer++ = ' ';
BufferCount++;
}
Separator = FALSE;
}
*TmpBuffer++ = c;
break;
}
}
*Count = BufferCount + 1;
return (NewBuffer);
}
示例11: TrGetNextNode
static ACPI_PARSE_OBJECT *
TrGetNextNode (
void)
{
if (Gbl_NodeCacheNext >= Gbl_NodeCacheLast)
{
Gbl_NodeCacheNext = UtLocalCalloc (sizeof (ACPI_PARSE_OBJECT) *
ASL_NODE_CACHE_SIZE);
Gbl_NodeCacheLast = Gbl_NodeCacheNext + ASL_NODE_CACHE_SIZE;
}
return (Gbl_NodeCacheNext++);
}
示例12: DtCompileSlit
ACPI_STATUS
DtCompileSlit (
void **List)
{
ACPI_STATUS Status;
DT_SUBTABLE *Subtable;
DT_SUBTABLE *ParentTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
DT_FIELD *FieldList;
UINT32 Localities;
UINT8 *LocalityBuffer;
UINT32 RemainingData;
Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
LocalityBuffer = UtLocalCalloc (Localities);
FieldList = *PFieldList;
while (FieldList)
{
/* Handle multiple-line buffer */
RemainingData = Localities;
while (RemainingData && FieldList)
{
RemainingData = DtCompileBuffer (
LocalityBuffer + (Localities - RemainingData),
FieldList->Value, FieldList, RemainingData);
FieldList = FieldList->Next;
}
DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
DtInsertSubtable (ParentTable, Subtable);
}
ACPI_FREE (LocalityBuffer);
return (AE_OK);
}
示例13: UtGetStringBuffer
char *
UtGetStringBuffer (
UINT32 Length)
{
char *Buffer;
if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast)
{
Gbl_StringCacheNext = UtLocalCalloc (ASL_STRING_CACHE_SIZE + Length);
Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE +
Length;
}
Buffer = Gbl_StringCacheNext;
Gbl_StringCacheNext += Length;
return (Buffer);
}
示例14: DtCompileSlit
ACPI_STATUS
DtCompileSlit (
void **List)
{
ACPI_STATUS Status;
DT_SUBTABLE *Subtable;
DT_SUBTABLE *ParentTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
DT_FIELD *FieldList;
UINT32 Localities;
UINT8 *LocalityBuffer;
Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
LocalityBuffer = UtLocalCalloc (Localities);
/* Compile each locality buffer */
FieldList = *PFieldList;
while (FieldList)
{
DtCompileBuffer (LocalityBuffer,
FieldList->Value, FieldList, Localities);
DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
DtInsertSubtable (ParentTable, Subtable);
FieldList = FieldList->Next;
}
ACPI_FREE (LocalityBuffer);
return (AE_OK);
}
示例15: PrPushInputFileStack
void
PrPushInputFileStack (
FILE *InputFile,
char *Filename)
{
PR_FILE_NODE *Fnode;
Gbl_HasIncludeFiles = TRUE;
/* Save the current state in an Fnode */
Fnode = UtLocalCalloc (sizeof (PR_FILE_NODE));
Fnode->File = Gbl_Files[ASL_FILE_INPUT].Handle;
Fnode->Next = Gbl_InputFileList;
Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
Fnode->CurrentLineNumber = Gbl_CurrentLineNumber;
/* Push it on the stack */
Gbl_InputFileList = Fnode;
DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID
"Push InputFile Stack: handle %p\n\n",
Gbl_CurrentLineNumber, InputFile);
/* Reset the global line count and filename */
Gbl_Files[ASL_FILE_INPUT].Filename =
UtStringCacheCalloc (strlen (Filename) + 1);
strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename);
Gbl_Files[ASL_FILE_INPUT].Handle = InputFile;
Gbl_CurrentLineNumber = 1;
/* Emit a new #line directive for the include file */
Gbl_CurrentLineNumber = 1;
FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n", 1, Filename);
}