Item

ItemPutPtr

Store a data pointer in an ITEM

Syntax

Signature
ITEM *ItemPutPtr( ITEM *item, void *value );

Arguments

item is an existing ITEM to replace. Pass NULL to allocate a new ITEM.

value is the pointer to store.

Return value

The destination ITEM, or a new caller-owned ITEM when item is NULL.

Description

Stores the address as IT_POINTER. The caller manages the lifetime of the object at that address.

Example

itemputptr.c
#include "xdev-wtui.h"

#include <stdio.h>

int main( void )
{
   int count = 42;
   ITEM *item = ItemPutPtr( NULL, &count );
   int *stored = ItemGetPtr( item );

   if( stored )
      printf( "%d\n", *stored );
   ItemRelease( item );

   return 0;
}

Output

42

See also