当前位置: 首页>>代码示例>>C++>>正文


C++ return_PTR函数代码示例

本文整理汇总了C++中return_PTR函数的典型用法代码示例。如果您正苦于以下问题:C++ return_PTR函数的具体用法?C++ return_PTR怎么用?C++ return_PTR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了return_PTR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ACPI_FUNCTION_TRACE

void *acpi_ut_allocate_object_desc_dbg(char *module_name,
				       u32 line_number, u32 component_id)
{
	union acpi_operand_object *object;

	ACPI_FUNCTION_TRACE(ut_allocate_object_desc_dbg);

	object = acpi_os_acquire_object(acpi_gbl_operand_cache);
	if (!object) {
		ACPI_ERROR((module_name, line_number,
			    "Could not allocate an object descriptor"));

		return_PTR(NULL);
	}

	/* Mark the descriptor type */

	memset(object, 0, sizeof(union acpi_operand_object));
	ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND);

	ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
			  object, (u32) sizeof(union acpi_operand_object)));

	return_PTR(object);
}
开发者ID:420GrayFox,项目名称:dsl-n55u-bender,代码行数:25,代码来源:utobject.c

示例2: ACPI_FUNCTION_TRACE_STR

union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name,
							      u32 line_number,
							      u32 component_id,
							      acpi_object_type
							      type)
{
	union acpi_operand_object *object;
	union acpi_operand_object *second_object;

	ACPI_FUNCTION_TRACE_STR(ut_create_internal_object_dbg,
				acpi_ut_get_type_name(type));

	/* Allocate the raw object descriptor */

	object =
	    acpi_ut_allocate_object_desc_dbg(module_name, line_number,
					     component_id);
	if (!object) {
		return_PTR(NULL);
	}

	switch (type) {
	case ACPI_TYPE_REGION:
	case ACPI_TYPE_BUFFER_FIELD:

		/* These types require a secondary object */

		second_object = acpi_ut_allocate_object_desc_dbg(module_name,
								 line_number,
								 component_id);
		if (!second_object) {
			acpi_ut_delete_object_desc(object);
			return_PTR(NULL);
		}

		second_object->common.type = ACPI_TYPE_LOCAL_EXTRA;
		second_object->common.reference_count = 1;

		/* Link the second object to the first */

		object->common.next_object = second_object;
		break;

	default:
		/* All others have no secondary object */
		break;
	}

	/* Save the object type in the object descriptor */

	object->common.type = (u8) type;

	/* Init the reference count */

	object->common.reference_count = 1;

	/* Any per-type initialization should go here */

	return_PTR(object);
}
开发者ID:420GrayFox,项目名称:dsl-n55u-bender,代码行数:60,代码来源:utobject.c

示例3: ACPI_FUNCTION_TRACE_PTR

union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
						   void *external_object,
						   u16 index)
{
	union acpi_generic_state *state;

	ACPI_FUNCTION_TRACE_PTR(ut_create_pkg_state, internal_object);

	/* Create the generic state object */

	state = acpi_ut_create_generic_state();
	if (!state) {
		return_PTR(NULL);
	}

	/* Init fields specific to the update struct */

	state->common.descriptor_type = ACPI_DESC_TYPE_STATE_PACKAGE;
	state->pkg.source_object = (union acpi_operand_object *)internal_object;
	state->pkg.dest_object = external_object;
	state->pkg.index = index;
	state->pkg.num_packages = 1;

	return_PTR(state);
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:25,代码来源:utstate.c

示例4: ACPI_FUNCTION_TRACE_PTR

char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
{
	acpi_status status;
	char *name_buffer;
	acpi_size size;

	ACPI_FUNCTION_TRACE_PTR(ns_get_external_pathname, node);

	

	size = acpi_ns_get_pathname_length(node);
	if (!size) {
		return_PTR(NULL);
	}

	

	name_buffer = ACPI_ALLOCATE_ZEROED(size);
	if (!name_buffer) {
		ACPI_ERROR((AE_INFO, "Could not allocate %u bytes", (u32)size));
		return_PTR(NULL);
	}

	

	status = acpi_ns_build_external_path(node, size, name_buffer);
	if (ACPI_FAILURE(status)) {
		ACPI_FREE(name_buffer);
		return_PTR(NULL);
	}

	return_PTR(name_buffer);
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:33,代码来源:nsnames.c

示例5: AcpiUtCreateInternalObjectDbg

ACPI_OPERAND_OBJECT  *
AcpiUtCreateInternalObjectDbg (
    NATIVE_CHAR             *ModuleName,
    UINT32                  LineNumber,
    UINT32                  ComponentId,
    ACPI_OBJECT_TYPE8       Type)
{
    ACPI_OPERAND_OBJECT     *Object;


    FUNCTION_TRACE_STR ("UtCreateInternalObjectDbg", AcpiUtGetTypeName (Type));


    /* Allocate the raw object descriptor */

    Object = AcpiUtAllocateObjectDescDbg (ModuleName, LineNumber, ComponentId);
    if (!Object)
    {
        /* Allocation failure */

        return_PTR (NULL);
    }

    /* Save the object type in the object descriptor */

    Object->Common.Type = Type;

    /* Init the reference count */

    Object->Common.ReferenceCount = 1;

    /* Any per-type initialization should go here */

    return_PTR (Object);
}
开发者ID:MarginC,项目名称:kame,代码行数:35,代码来源:utobject.c

示例6: ACPI_FUNCTION_TRACE

struct acpi_thread_state *acpi_ut_create_thread_state(void)
{
	union acpi_generic_state *state;

	ACPI_FUNCTION_TRACE(ut_create_thread_state);

	/* Create the generic state object */

	state = acpi_ut_create_generic_state();
	if (!state) {
		return_PTR(NULL);
	}

	/* Init fields specific to the update struct */

	state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD;
	state->thread.thread_id = acpi_os_get_thread_id();

	/* Check for invalid thread ID - zero is very bad, it will break things */

	if (!state->thread.thread_id) {
		ACPI_ERROR((AE_INFO, "Invalid zero ID from AcpiOsGetThreadId"));
		state->thread.thread_id = (acpi_thread_id) 1;
	}

	return_PTR((struct acpi_thread_state *)state);
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:27,代码来源:utstate.c

示例7: ACPI_FUNCTION_TRACE

/*******************************************************************************
 *
 * FUNCTION:    acpi_ns_create_node
 *
 * PARAMETERS:  Name            - Name of the new node (4 char ACPI name)
 *
 * RETURN:      New namespace node (Null on failure)
 *
 * DESCRIPTION: Create a namespace node
 *
 ******************************************************************************/
struct acpi_namespace_node *acpi_ns_create_node(u32 name)
{
	struct acpi_namespace_node *node;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
	u32 temp;
#endif

	ACPI_FUNCTION_TRACE(ns_create_node);

	node = acpi_os_acquire_object(acpi_gbl_namespace_cache);
	if (!node) {
		return_PTR(NULL);
	}

	ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++);

#ifdef ACPI_DBG_TRACK_ALLOCATIONS
	temp = acpi_gbl_ns_node_list->total_allocated -
	    acpi_gbl_ns_node_list->total_freed;
	if (temp > acpi_gbl_ns_node_list->max_occupied) {
		acpi_gbl_ns_node_list->max_occupied = temp;
	}
#endif

	node->name.integer = name;
	ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED);
	return_PTR(node);
}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:39,代码来源:nsalloc.c

示例8: AcpiUtAllocateObjectDescDbg

void *
AcpiUtAllocateObjectDescDbg (
    NATIVE_CHAR             *ModuleName,
    UINT32                  LineNumber,
    UINT32                  ComponentId)
{
    ACPI_OPERAND_OBJECT     *Object;


    FUNCTION_TRACE ("UtAllocateObjectDescDbg");


    Object = AcpiUtAcquireFromCache (ACPI_MEM_LIST_OPERAND);
    if (!Object)
    {
        _REPORT_ERROR (ModuleName, LineNumber, ComponentId,
                        ("Could not allocate an object descriptor\n"));

        return_PTR (NULL);
    }


    /* Mark the descriptor type */

    Object->Common.DataType = ACPI_DESC_TYPE_INTERNAL;

    ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
            Object, sizeof (ACPI_OPERAND_OBJECT)));

    return_PTR (Object);
}
开发者ID:MarginC,项目名称:kame,代码行数:31,代码来源:utobject.c

示例9: AcpiUtAllocate

void *
AcpiUtAllocate (
    ACPI_SIZE               Size,
    UINT32                  Component,
    const char              *Module,
    UINT32                  Line)
{
    void                    *Allocation;


    ACPI_FUNCTION_TRACE_U32 (UtAllocate, Size);


    /* Check for an inadvertent size of zero bytes */

    if (!Size)
    {
        ACPI_WARNING ((Module, Line,
            "Attempt to allocate zero bytes, allocating 1 byte"));
        Size = 1;
    }

    Allocation = AcpiOsAllocate (Size);
    if (!Allocation)
    {
        /* Report allocation error */

        ACPI_WARNING ((Module, Line,
            "Could not allocate size %u", (UINT32) Size));

        return_PTR (NULL);
    }

    return_PTR (Allocation);
}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:35,代码来源:utalloc.c

示例10: acpi_ns_get_external_pathname

char *
acpi_ns_get_external_pathname (
	struct acpi_namespace_node      *node)
{
	char                            *name_buffer;
	acpi_size                       size;


	ACPI_FUNCTION_TRACE_PTR ("ns_get_external_pathname", node);


	/* Calculate required buffer size based on depth below root */

	size = acpi_ns_get_pathname_length (node);

	/* Allocate a buffer to be returned to caller */

	name_buffer = ACPI_MEM_CALLOCATE (size);
	if (!name_buffer) {
		ACPI_REPORT_ERROR (("ns_get_table_pathname: allocation failure\n"));
		return_PTR (NULL);
	}

	/* Build the path in the allocated buffer */

	acpi_ns_build_external_path (node, size, name_buffer);
	return_PTR (name_buffer);
}
开发者ID:leonsh,项目名称:eldk30ppc,代码行数:28,代码来源:nsnames.c

示例11: ACPI_FUNCTION_TRACE_U32

void *acpi_ut_allocate(acpi_size size,
		       u32 component, const char *module, u32 line)
{
	void *allocation;

	ACPI_FUNCTION_TRACE_U32(ut_allocate, size);

	/* Check for an inadvertent size of zero bytes */

	if (!size) {
		ACPI_WARNING((module, line,
			      "Attempt to allocate zero bytes, allocating 1 byte"));
		size = 1;
	}

	allocation = acpi_os_allocate(size);
	if (!allocation) {

		/* Report allocation error */

		ACPI_WARNING((module, line,
			      "Could not allocate size %u", (u32) size));

		return_PTR(NULL);
	}

	return_PTR(allocation);
}
开发者ID:08opt,项目名称:linux,代码行数:28,代码来源:utalloc.c

示例12: ACPI_FUNCTION_TRACE_U32

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);
}
开发者ID:420GrayFox,项目名称:dsl-n55u-bender,代码行数:35,代码来源:utobject.c

示例13: acpi_tb_uninstall_table

acpi_table_desc *
acpi_tb_uninstall_table (
    acpi_table_desc         *table_desc)
{
    acpi_table_desc         *next_desc;


    FUNCTION_TRACE_PTR ("Tb_delete_single_table", table_desc);


    if (!table_desc) {
        return_PTR (NULL);
    }


    /* Unlink the descriptor */

    if (table_desc->prev) {
        table_desc->prev->next = table_desc->next;
    }

    if (table_desc->next) {
        table_desc->next->prev = table_desc->prev;
    }


    /* Free the memory allocated for the table itself */

    acpi_tb_delete_single_table (table_desc);


    /* Free the table descriptor (Don't delete the list head, tho) */

    if ((table_desc->prev) == (table_desc->next)) {

        next_desc = NULL;

        /* Clear the list head */

        table_desc->pointer  = NULL;
        table_desc->length   = 0;
        table_desc->count    = 0;

    }

    else {
        /* Free the table descriptor */

        next_desc = table_desc->next;
        ACPI_MEM_FREE (table_desc);
    }


    return_PTR (next_desc);
}
开发者ID:hugh712,项目名称:Jollen,代码行数:55,代码来源:tbinstal.c

示例14: AcpiTbUninstallTable

ACPI_TABLE_DESC *
AcpiTbUninstallTable (
    ACPI_TABLE_DESC         *TableDesc)
{
    ACPI_TABLE_DESC         *NextDesc;


    ACPI_FUNCTION_TRACE_PTR (TbUninstallTable, TableDesc);


    if (!TableDesc)
    {
        return_PTR (NULL);
    }

    /* Unlink the descriptor from the doubly linked list */

    if (TableDesc->Prev)
    {
        TableDesc->Prev->Next = TableDesc->Next;
    }
    else
    {
        /* Is first on list, update list head */

        AcpiGbl_TableLists[TableDesc->Type].Next = TableDesc->Next;
    }

    if (TableDesc->Next)
    {
        TableDesc->Next->Prev = TableDesc->Prev;
    }

    /* Free the memory allocated for the table itself */

    AcpiTbDeleteSingleTable (TableDesc);

    /* Free the owner ID associated with this table */

    AcpiUtReleaseOwnerId (&TableDesc->OwnerId);

    /* Free the table descriptor */

    NextDesc = TableDesc->Next;
    ACPI_FREE (TableDesc);

    /* Return pointer to the next descriptor */

    return_PTR (NextDesc);
}
开发者ID:andreiw,项目名称:polaris,代码行数:50,代码来源:tbinstal.c

示例15: AcpiDsMethodDataGetNode

ACPI_NAMESPACE_NODE *
AcpiDsMethodDataGetNode (
    UINT16                  Opcode,
    UINT32                  Index,
    ACPI_WALK_STATE         *WalkState)
{
    ACPI_NAMESPACE_NODE     *Node = NULL;


    FUNCTION_TRACE ("DsMethodDataGetNode");


    switch (Opcode)
    {

    case AML_LOCAL_OP:

        if (Index > MTH_MAX_LOCAL)
        {
            ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n",
                               Index, MTH_MAX_LOCAL));
            return_PTR (Node);
        }

        Node =  &WalkState->LocalVariables[Index];
        break;


    case AML_ARG_OP:

        if (Index > MTH_MAX_ARG)
        {
            ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n",
                               Index, MTH_MAX_ARG));
            return_PTR (Node);
        }

        Node = &WalkState->Arguments[Index];
        break;


    default:
        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", Opcode));
        break;
    }


    return_PTR (Node);
}
开发者ID:MarginC,项目名称:kame,代码行数:49,代码来源:dsmthdat.c


注:本文中的return_PTR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。