+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ut_create_string_object
+ *
+ * PARAMETERS: string_size - 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
+ *
+ ******************************************************************************/
+
+union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
+{
+ union acpi_operand_object *string_desc;
+ char *string;
+
+ ACPI_FUNCTION_TRACE_U32(ut_create_string_object, string_size);
+
+ /* Create a new String object */
+
+ string_desc = acpi_ut_create_internal_object(ACPI_TYPE_STRING);
+ if (!string_desc) {
+ return_PTR(NULL);
+ }
+
+ /*
+ * Allocate the actual string buffer -- (Size + 1) for NULL terminator.
+ * NOTE: Zero-length strings are NULL terminated
+ */
+ string = ACPI_ALLOCATE_ZEROED(string_size + 1);
+ if (!string) {
+ ACPI_ERROR((AE_INFO, "Could not allocate size %X",
+ (u32) string_size));
+ acpi_ut_remove_reference(string_desc);
+ return_PTR(NULL);
+ }
+
+ /* Complete string object initialization */
+
+ string_desc->string.pointer = string;
+ string_desc->string.length = (u32) string_size;
+
+ /* Return the new string descriptor */
+
+ return_PTR(string_desc);
+}