Back to mnoGoSearch site

UdmEnvInit

Name

UdmEnvInit -- Allocates or initializes a search context variable

Description

UDM_ENV* UdmEnvInit(UDM_ENV* Env);

Allocates or initializes an UDM_ENV variable (search context). Search context is later associated with a set of configuration commands.

If Env is a NULL pointer, the function allocates, initializes, and returns a new variable. Otherwise, the variable is initialized and the address of the variable is returned. If UdmEnvInit() allocates a new variable, it is freed when UdmEnvFree() is called to close search context.

Parameters

Env

Pointer to a variable of type UDM_ENV, or NULL.

Return Values

Pointer to initialized UDM_ENV variable on success, NULL there was insufficient memory to allocate a new variable.

Examples

Example 1. UdmEnvInit example #1


UDM_ENV *Env;

if (!(Env= UdmEnvInit(NULL)))
{
  printf('Fatal error: could not allocate Env');
  exit(1);
}

    

Example 2. UdmEnvInit example #2


UDM_ENV Env;

if (!UdmEnvInit(&Env))
{
  printf('Fatal error: could not initialize Env');
  exit(1);
}

    

Notes

Even if Env points to an existing variable of UDM_ENV type, UdmFree() should still be called in the end of your program.

See Also

UdmEnvFree
UdmAgentInit
UdmAgentFree