Item

ItemNew

Allocate a new ITEM

Syntax

Signature
ITEM *ItemNew( const ITEM *source );

Arguments

source is an existing value to copy. Pass NULL to create a NIL value.

Return value

A new ITEM owned by the caller.

Description

A string is copied into independent storage; an array is not copied: the new ITEM holds the same array. AClone() duplicates an array. Release the new ITEM with ItemRelease().

Example

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

#include <stdio.h>

int main( void )
{
   ITEM *original = ItemPutC( NULL, "Open" );
   ITEM *copy = ItemNew( original );

   ItemRelease( original );
   puts( ItemGetCPtr( copy ) );
   ItemRelease( copy );

   return 0;
}

Output

Open

See also