diff options
Diffstat (limited to 'sys/contrib/dev/acpica/utobject.c')
-rw-r--r-- | sys/contrib/dev/acpica/utobject.c | 64 |
1 files changed, 60 insertions, 4 deletions
diff --git a/sys/contrib/dev/acpica/utobject.c b/sys/contrib/dev/acpica/utobject.c index f9e4283..5965891 100644 --- a/sys/contrib/dev/acpica/utobject.c +++ b/sys/contrib/dev/acpica/utobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utobject - ACPI object create/delete/size/cache routines - * $Revision: 86 $ + * $Revision: 90 $ * *****************************************************************************/ @@ -232,9 +232,8 @@ AcpiUtCreateBufferObject ( ACPI_FUNCTION_TRACE_U32 ("UtCreateBufferObject", BufferSize); - /* - * Create a new Buffer object - */ + /* Create a new Buffer object */ + BufferDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); if (!BufferDesc) { @@ -271,6 +270,63 @@ AcpiUtCreateBufferObject ( /******************************************************************************* * + * FUNCTION: AcpiUtCreateStringObject + * + * PARAMETERS: StringSize - Size of string to be created. Does not + * include NULL terminator, this is added + * automatically. + * + * RETURN: Pointer to a new String object + * + * DESCRIPTION: Create a fully initialized string object + * + ******************************************************************************/ + +ACPI_OPERAND_OBJECT * +AcpiUtCreateStringObject ( + ACPI_SIZE StringSize) +{ + ACPI_OPERAND_OBJECT *StringDesc; + char *String; + + + ACPI_FUNCTION_TRACE_U32 ("UtCreateStringObject", StringSize); + + + /* Create a new String object */ + + StringDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING); + if (!StringDesc) + { + return_PTR (NULL); + } + + /* + * Allocate the actual string buffer -- (Size + 1) for NULL terminator. + * NOTE: Zero-length strings are NULL terminated + */ + String = ACPI_MEM_CALLOCATE (StringSize + 1); + if (!String) + { + ACPI_REPORT_ERROR (("CreateString: could not allocate size %X\n", + (UINT32) StringSize)); + AcpiUtRemoveReference (StringDesc); + return_PTR (NULL); + } + + /* Complete string object initialization */ + + StringDesc->String.Pointer = String; + StringDesc->String.Length = (UINT32) StringSize; + + /* Return the new string descriptor */ + + return_PTR (StringDesc); +} + + +/******************************************************************************* + * * FUNCTION: AcpiUtValidInternalObject * * PARAMETERS: Object - Object to be validated |