Beispiel #1
0
/**
 * \brief Create a new link list.
 * \return Pointer to new link list structure. 
 */
PUBLIC linkList_t *linkList_new( void )
{
    linkList_t *list;

	list = (linkList_t *) MM_MALLOC( sizeof( linkList_t ) );
    if( list == NULL )
	{
        MM_OUTOFMEM( "linkList_new" );
	}

    list->element = NULL;
    list->next = NULL;

    return list;
}
Beispiel #2
0
/**
 * \brief Add element to link list.
 * \param[in] list Pointer to linkList_t structure.
 * \param[in] newElement Element to add to link list.
 * \return On success true, otherwise false.
 */
PUBLIC wtBoolean linkList_add( linkList_t *list, void *newElement )
{
    if( list )
	{
		linkList_t *newNode;
		
		newNode = (linkList_t *) MM_MALLOC( sizeof( linkList_t ) );
		if( newNode == NULL )
		{
			MM_OUTOFMEM( "linkList_add" );
		}

		newNode->element = newElement;
		newNode->next = list->next;
		list->next = newNode;
		
		return true;
    } 
	
    return false;
}
Beispiel #3
0
/**
 * \brief Add element to link list.
 * \param[in] list Pointer to linkList_t structure.
 * \param[in] newElement Element to add to link list.
 * \return On success pointer to newly added node, otherwise NULL.
 */
PUBLIC linkList_t *linkList_addList( linkList_t *list, void *newElement )
{
    if( list )
	{
		linkList_t *newNode;

		newNode = (linkList_t *) MM_MALLOC( sizeof( linkList_t ) );
		if( newNode == NULL )
		{
			MM_OUTOFMEM( "linkList_addList" );
		}

		newNode->element = newElement;
		newNode->next = list->next;
		list->next = newNode;

		return newNode;
    } 

    return (linkList_t *) NULL;
}
/**
 * \brief Get map data chunk.
 * \param[in] chunkOffset Source buffer to convert from
 * \param[in] chunkLength Size of chunk data.
 * \return NULL on error, otherwise pointer to map data.
 * \note Caller must free allocated data.
 */
PUBLIC void *MapFile_getMapData( W32 chunkOffset, W32 chunkLength )
{
	void *mapdata;

	if( map_file_handle == NULL )
	{
		return NULL;
	}

	mapdata = MM_MALLOC( chunkLength );
	if( NULL == mapdata )
	{
		MM_OUTOFMEM( "MapFile_getMapData"  );

		return NULL;
	}

	fseek( map_file_handle, chunkOffset, SEEK_SET );

	fread( mapdata, 1, chunkLength, map_file_handle );


	return mapdata;
}