diff options
Diffstat (limited to 'source/components/utilities')
-rw-r--r-- | source/components/utilities/utclib.c | 142 | ||||
-rw-r--r-- | source/components/utilities/utdecode.c | 4 | ||||
-rw-r--r-- | source/components/utilities/utdelete.c | 5 | ||||
-rw-r--r-- | source/components/utilities/utmutex.c | 19 | ||||
-rw-r--r-- | source/components/utilities/utresrc.c | 2 |
5 files changed, 148 insertions, 24 deletions
diff --git a/source/components/utilities/utclib.c b/source/components/utilities/utclib.c index 8c188d00a4cf..9b4c9c6f733d 100644 --- a/source/components/utilities/utclib.c +++ b/source/components/utilities/utclib.c @@ -129,6 +129,61 @@ memcmp ( /******************************************************************************* * + * FUNCTION: memmove + * + * PARAMETERS: Dest - Target of the copy + * Src - Source buffer to copy + * Count - Number of bytes to copy + * + * RETURN: Dest + * + * DESCRIPTION: Copy arbitrary bytes of memory with respect to the overlapping + * + ******************************************************************************/ + +void * +memmove ( + void *Dest, + const void *Src, + ACPI_SIZE Count) +{ + char *New = (char *) Dest; + char *Old = (char *) Src; + + + if (Old > New) + { + /* Copy from the beginning */ + + while (Count) + { + *New = *Old; + New++; + Old++; + Count--; + } + } + else if (Old < New) + { + /* Copy from the end */ + + New = New + Count - 1; + Old = Old + Count - 1; + while (Count) + { + *New = *Old; + New--; + Old--; + Count--; + } + } + + return (Dest); +} + + +/******************************************************************************* + * * FUNCTION: memcpy * * PARAMETERS: Dest - Target of the copy @@ -231,6 +286,93 @@ strlen ( /******************************************************************************* * + * FUNCTION: strpbrk + * + * PARAMETERS: String - Null terminated string + * Delimiters - Delimiters to match + * + * RETURN: The first occurance in the string of any of the bytes in the + * delimiters + * + * DESCRIPTION: Search a string for any of a set of the delimiters + * + ******************************************************************************/ + +char * +strpbrk ( + const char *String, + const char *Delimiters) +{ + const char *Delimiter; + + + for ( ; *String != '\0'; ++String) + { + for (Delimiter = Delimiters; *Delimiter != '\0'; Delimiter++) + { + if (*String == *Delimiter) + { + return (ACPI_CAST_PTR (char, String)); + } + } + } + + return (NULL); +} + + +/******************************************************************************* + * + * FUNCTION: strtok + * + * PARAMETERS: String - Null terminated string + * Delimiters - Delimiters to match + * + * RETURN: Pointer to the next token + * + * DESCRIPTION: Split string into tokens + * + ******************************************************************************/ + +char* +strtok ( + char *String, + const char *Delimiters) +{ + char *Begin = String; + static char *SavedPtr; + + + if (Begin == NULL) + { + if (SavedPtr == NULL) + { + return (NULL); + } + Begin = SavedPtr; + } + + SavedPtr = strpbrk (Begin, Delimiters); + while (SavedPtr == Begin) + { + *Begin++ = '\0'; + SavedPtr = strpbrk (Begin, Delimiters); + } + + if (SavedPtr) + { + *SavedPtr++ = '\0'; + return (Begin); + } + else + { + return (NULL); + } +} + + +/******************************************************************************* + * * FUNCTION: strcpy * * PARAMETERS: DstString - Target of the copy diff --git a/source/components/utilities/utdecode.c b/source/components/utilities/utdecode.c index 45adf14c6d9e..1a79286ccf36 100644 --- a/source/components/utilities/utdecode.c +++ b/source/components/utilities/utdecode.c @@ -269,7 +269,7 @@ AcpiUtGetObjectTypeName ( if (!ObjDesc) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); - return_PTR ("[NULL Object Descriptor]"); + return_STR ("[NULL Object Descriptor]"); } /* These descriptor types share a common area */ @@ -282,7 +282,7 @@ AcpiUtGetObjectTypeName ( ACPI_GET_DESCRIPTOR_TYPE (ObjDesc), AcpiUtGetDescriptorName (ObjDesc), ObjDesc)); - return_PTR ("Invalid object"); + return_STR ("Invalid object"); } return_STR (AcpiUtGetTypeName (ObjDesc->Common.Type)); diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c index 95a98f568183..d36eedfe69e9 100644 --- a/source/components/utilities/utdelete.c +++ b/source/components/utilities/utdelete.c @@ -449,8 +449,9 @@ AcpiUtUpdateRefCount ( } ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Obj %p Type %.2X Refs %.2X [Incremented]\n", - Object, Object->Common.Type, NewCount)); + "Obj %p Type %.2X [%s] Refs %.2X [Incremented]\n", + Object, Object->Common.Type, + AcpiUtGetObjectTypeName (Object), NewCount)); break; case REF_DECREMENT: diff --git a/source/components/utilities/utmutex.c b/source/components/utilities/utmutex.c index 83b1cee0d79e..563ef600ccd1 100644 --- a/source/components/utilities/utmutex.c +++ b/source/components/utilities/utmutex.c @@ -129,19 +129,6 @@ AcpiUtMutexInitialize ( return_ACPI_STATUS (Status); } -#ifdef ACPI_DEBUGGER - - /* Debugger Support */ - - Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandReady); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandComplete); -#endif - return_ACPI_STATUS (Status); } @@ -187,12 +174,6 @@ AcpiUtMutexTerminate ( /* Delete the reader/writer lock */ AcpiUtDeleteRwLock (&AcpiGbl_NamespaceRwLock); - -#ifdef ACPI_DEBUGGER - AcpiOsDeleteMutex (AcpiGbl_DbCommandReady); - AcpiOsDeleteMutex (AcpiGbl_DbCommandComplete); -#endif - return_VOID; } diff --git a/source/components/utilities/utresrc.c b/source/components/utilities/utresrc.c index 8c44a1cab8f8..a3b0523fc8da 100644 --- a/source/components/utilities/utresrc.c +++ b/source/components/utilities/utresrc.c @@ -472,7 +472,7 @@ AcpiUtWalkAmlResources ( * The absolute minimum resource template is one EndTag descriptor. * However, we will treat a lone EndTag as just a simple buffer. */ - if (AmlLength <= sizeof (AML_RESOURCE_END_TAG)) + if (AmlLength < sizeof (AML_RESOURCE_END_TAG)) { return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); } |