deps/acpica/source/components/utilities/uttrack.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiUtFindAllocation
 *
 * PARAMETERS:  Allocation              - Address of allocated memory
 *
 * RETURN:      Three cases:
 *              1) List is empty, NULL is returned.
 *              2) Element was found. Returns Allocation parameter.
 *              3) Element was not found. Returns position where it should be
 *                  inserted into the list.
 *
 * DESCRIPTION: Searches for an element in the global allocation tracking list.
 *              If the element is not found, returns the location within the
 *              list where the element should be inserted.
 *
 *              Note: The list is ordered by larger-to-smaller addresses.
 *
 *              This global list is used to detect memory leaks in ACPICA as
 *              well as other issues such as an attempt to release the same
 *              internal object more than once. Although expensive as far
 *              as cpu time, this list is much more helpful for finding these
 *              types of issues than using memory leak detectors outside of
 *              the ACPICA code.
 *
 ******************************************************************************/
AcpiUtFindAllocation
PARAMETERS:  Allocation              - Address of allocated memory

Three cases:
1) List is empty, NULL is returned.
2) Element was found. Returns Allocation parameter.
3) Element was not found. Returns position where it should be
inserted into the list.

Searches for an element in the global allocation tracking list.
If the element is not found, returns the location within the
list where the element should be inserted.

The list is ordered by larger-to-smaller addresses.

This global list is used to detect memory leaks in ACPICA as
well as other issues such as an attempt to release the same
internal object more than once. Although expensive as far
as cpu time, this list is much more helpful for finding these
types of issues than using memory leak detectors outside of
the ACPICA code.
AcpiUtFindAllocation PARAMETERS : Allocation - Address of allocated memory Three cases : 1 ) List is empty NULL is returned . 2 ) Element was found . Returns Allocation parameter . 3 ) Element was not found . Returns position where it should be inserted into the list . Searches for an element in the global allocation tracking list . If the element is not found returns the location within the list where the element should be inserted . The list is ordered by larger - to - smaller addresses . This global list is used to detect memory leaks in ACPICA as well as other issues such as an attempt to release the same internal object more than once . Although expensive as far as cpu time this list is much more helpful for finding these types of issues than using memory leak detectors outside of the ACPICA code .
static ACPI_DEBUG_MEM_BLOCK *
AcpiUtFindAllocation (
    ACPI_DEBUG_MEM_BLOCK    *Allocation)
{
    ACPI_DEBUG_MEM_BLOCK    *Element;
    Element = AcpiGbl_GlobalList->ListHead;
    if (!Element)
    {
        return (NULL);
    }
    while (Element > Allocation)
    {
        if (!Element->Next)
        {
            return (Element);
        }
        Element = Element->Next;
    }
    if (Element == Allocation)
    {
        return (Element);
    }
    return (Element->Previous);
}
static ACPI_DEBUG_MEM_BLOCK * AcpiUtFindAllocation ( ACPI_DEBUG_MEM_BLOCK * Allocation ) { ACPI_DEBUG_MEM_BLOCK * Element ; Element = AcpiGbl_GlobalList -> ListHead ; if ( ! Element ) { return ( NULL ) ; } while ( Element > Allocation ) { if ( ! Element -> Next ) { return ( Element ) ; } Element = Element -> Next ; } if ( Element == Allocation ) { return ( Element ) ; } return ( Element -> Previous ) ; }
FUNCTION:    AcpiUtFindAllocation
 PARAMETERS:  Allocation              - Address of allocated memory
FUNCTION : AcpiUtFindAllocation PARAMETERS : Allocation - Address of allocated memory
/*
     * Search for the address.
     *
     * Note: List is ordered by larger-to-smaller addresses, on the
     * assumption that a new allocation usually has a larger address
     * than previous allocations.
     */ /* Check for end-of-list */