NCBI C++ ToolKit
Functions
ncbi_std.c File Reference

A few utilities needed by code in algo/blast/core but not provided elsewhere. More...

#include <algo/blast/core/blast_def.h>
#include <algo/blast/core/ncbi_std.h>
+ Include dependency graph for ncbi_std.c:

Go to the source code of this file.

Go to the SVN repository for this file.

Functions

void * BlastMemDup (const void *orig, size_t size)
 Copies memory using memcpy and malloc. More...
 
ListNodeListNodeNew (ListNode *vnp)
 Create a new list node. More...
 
ListNodeListNodeAdd (ListNode **head)
 Add a node to the list. More...
 
ListNodeListNodeAddPointer (ListNode **head, Uint1 choice, void *value)
 Add a node to the list with a given choice and data pointer. More...
 
ListNodeListNodeCopyStr (ListNode **head, Uint1 choice, const char *str)
 Add a node to the list with a provided choice, and attached data pointing to a provided string. More...
 
ListNodeListNodeFree (ListNode *vnp)
 Free all list's nodes, does not attempt to free data. More...
 
ListNodeListNodeFreeData (ListNode *vnp)
 Free nodes as well as data (vnp->ptr) assuming it is one contiguous chunk. More...
 

Detailed Description

A few utilities needed by code in algo/blast/core but not provided elsewhere.

Definition in file ncbi_std.c.

Function Documentation

◆ BlastMemDup()

void* BlastMemDup ( const void *  orig,
size_t  size 
)

◆ ListNodeAdd()

ListNode* ListNodeAdd ( ListNode **  head)

Add a node to the list.

Parameters
headPointer to the start of the list, if *head is NULL will be Pointer to new node. [in] [out]
Returns
New node

Definition at line 77 of file ncbi_std.c.

References head, ListNodeNew(), and NULL.

Referenced by ListNodeAddPointer(), and ListNodeCopyStr().

◆ ListNodeAddPointer()

ListNode* ListNodeAddPointer ( ListNode **  head,
Uint1  choice,
void *  value 
)

Add a node to the list with a given choice and data pointer.

Parameters
headPointer to the start of the list, if *head is NULL will be Pointer to new node. [in] [out]
choiceChoice value for the new node. [in]
valueData pointer for the new node. [in]
Returns
New node

Definition at line 99 of file ncbi_std.c.

References ListNode::choice, head, ListNodeAdd(), NULL, ListNode::ptr, and rapidjson::value.

Referenced by BlastLoadMatrixValues().

◆ ListNodeCopyStr()

ListNode* ListNodeCopyStr ( ListNode **  head,
Uint1  choice,
const char *  str 
)

Add a node to the list with a provided choice, and attached data pointing to a provided string.

Parameters
headPointer to the start of the list, if *head is NULL will be Pointer to new node. [in] [out]
choicesets the "choice" field in ListNode [in]
strchar* buffer to be copied [in]
Returns
newly allocated node

Definition at line 124 of file ncbi_std.c.

References ListNode::choice, head, ListNodeAdd(), NULL, ListNode::ptr, str(), and strdup.

Referenced by BlastScoreBlkNucleotideMatrixRead(), and BlastScoreBlkProteinMatrixRead().

◆ ListNodeFree()

ListNode* ListNodeFree ( ListNode vnp)

Free all list's nodes, does not attempt to free data.

Parameters
vnpobjects to be freed [in]
Returns
NULL

Definition at line 148 of file ncbi_std.c.

References ListNode::next, next(), NULL, and sfree.

Referenced by BlastMatrixValuesDestruct().

◆ ListNodeFreeData()

ListNode* ListNodeFreeData ( ListNode vnp)

Free nodes as well as data (vnp->ptr) assuming it is one contiguous chunk.

Parameters
vnpobjects to be freed [in]
Returns
NULL

Definition at line 169 of file ncbi_std.c.

References ListNode::next, next(), NULL, ListNode::ptr, and sfree.

Referenced by BlastScoreBlkFree().

◆ ListNodeNew()

ListNode* ListNodeNew ( ListNode vnp)

Create a new list node.

Parameters
vnpPointer to the start of the list, may be NULL [in]
Returns
newly allocated node

Definition at line 55 of file ncbi_std.c.

References calloc(), ListNode::next, and NULL.

Referenced by ListNodeAdd().

Modified on Sat May 25 14:19:00 2024 by modify_doxy.py rev. 669887