NCBI C++ ToolKit
Macros | Functions | Variables
mem.c File Reference
#include <config.h>
#include <stdlib.h>
#include <assert.h>
#include <freetds/tds.h>
#include <freetds/iconv.h>
#include <freetds/tls.h>
#include <freetds/checks.h>
#include <freetds/string.h>
#include "replacements.h"
#include <freetds/enum_cap.h>
+ Include dependency graph for mem.c:

Go to the source code of this file.

Go to the SVN repository for this file.


#define TEST_MALLOC(dest, type)    {if (!(dest = (type*)calloc(1, sizeof(type)))) goto Cleanup;}
#define TEST_CALLOC(dest, type, n)    {if (!(dest = (type*)calloc((n), sizeof(type)))) goto Cleanup;}
#define REQ(i, n)   |(((TDS_REQ_ ## n / 8) == i)?(1<<(TDS_REQ_ ## n & 7)):0)
#define REQB(i)   0 SUPPORTED_REQ_CAP(i)
#define RES(i, n)   |(((TDS_RES_ ## n / 8) == i)?(1<<(TDS_RES_ ## n & 7)):0)
#define RESB(i)   0 SUPPORTED_RES_CAP(i)
#define SQLS_ENTRY(number, state)   case number: p = state; break


static void tds_free_env (TDSCONNECTION *conn)
static void tds_free_compute_results (TDSSOCKET *tds)
static void tds_free_compute_result (TDSCOMPUTEINFO *comp_info)
static char * tds_get_dynid (TDSCONNECTION *conn, char *id)
 Get an id for dynamic query based on TDS information. More...
static TDSCOLUMNtds_alloc_column (void)
static void tds_free_column (TDSCOLUMN *col)
TDSDYNAMICtds_alloc_dynamic (TDSCONNECTION *conn, const char *id)
 Allocate a dynamic statement. More...
void tds_free_input_params (TDSDYNAMIC *dyn)
 Frees all allocated input parameters of a dynamic statement. More...
void tds_dynamic_deallocated (TDSCONNECTION *conn, TDSDYNAMIC *dyn)
void tds_release_dynamic (TDSDYNAMIC **pdyn)
 Frees dynamic statement. More...
TDSPARAMINFOtds_alloc_param_result (TDSPARAMINFO *old_param)
 Adds a output parameter to TDSPARAMINFO. More...
void tds_free_param_result (TDSPARAMINFO *param_info)
 Delete latest parameter. More...
static void tds_param_free (TDSCOLUMN *col)
void * tds_alloc_param_data (TDSCOLUMN *curparam)
 Allocate data for a parameter. More...
static TDSCOMPUTEINFOtds_alloc_compute_result (TDS_USMALLINT num_cols, TDS_USMALLINT by_cols)
 Allocate memory for storing compute info return NULL on out of memory. More...
TDSCOMPUTEINFO ** tds_alloc_compute_results (TDSSOCKET *tds, TDS_USMALLINT num_cols, TDS_USMALLINT by_cols)
TDSRESULTINFOtds_alloc_results (TDS_USMALLINT num_cols)
void tds_set_current_results (TDSSOCKET *tds, TDSRESULTINFO *info)
void tds_detach_results (TDSRESULTINFO *info)
 Detach result info from it current socket. More...
static void tds_row_free (TDSRESULTINFO *res_info, unsigned char *row)
TDSRET tds_alloc_row (TDSRESULTINFO *res_info)
 Allocate space for row store return NULL on out of memory. More...
TDSRET tds_alloc_compute_row (TDSCOMPUTEINFO *res_info)
void tds_free_param_results (TDSPARAMINFO *param_info)
void tds_free_row (TDSRESULTINFO *res_info, unsigned char *row)
void tds_free_results (TDSRESULTINFO *res_info)
void tds_free_all_results (TDSSOCKET *tds)
static int winsock_initialized (void)
TDSCONTEXTtds_alloc_context (void *parent)
void tds_free_context (TDSCONTEXT *context)
TDSLOCALEtds_alloc_locale (void)
 TDS_COMPILE_CHECK (tds_values_len, sizeof(defaultcaps.types[0].values)==14)
 TDS_COMPILE_CHECK (tds_cap_len, sizeof(defaultcaps)==TDS_MAX_CAPABILITY)
TDSLOGINtds_init_login (TDSLOGIN *login, TDSLOCALE *locale)
 Initialize login structure with locale information and other stuff for connection. More...
TDSCURSORtds_alloc_cursor (TDSSOCKET *tds, const char *name, size_t namelen, const char *query, size_t querylen)
void tds_cursor_deallocated (TDSCONNECTION *conn, TDSCURSOR *cursor)
void tds_release_cursor (TDSCURSOR **pcursor)
TDSLOGINtds_alloc_login (int use_environment)
void tds_free_login (TDSLOGIN *login)
TDSPACKETtds_alloc_packet (void *buf, unsigned len)
TDSPACKETtds_realloc_packet (TDSPACKET *packet, unsigned len)
void tds_free_packets (TDSPACKET *packet)
static void tds_deinit_connection (TDSCONNECTION *conn)
static TDSCONNECTIONtds_init_connection (TDSCONNECTION *conn, TDSCONTEXT *context, unsigned int bufsize)
static TDSSOCKETtds_init_socket (TDSSOCKET *tds_socket, unsigned int bufsize)
TDSSOCKETtds_alloc_socket (TDSCONTEXT *context, unsigned int bufsize)
TDSSOCKETtds_realloc_socket (TDSSOCKET *tds, unsigned int bufsize)
static void tds_connection_remove_socket (TDSCONNECTION *conn, TDSSOCKET *tds)
void tds_free_socket (TDSSOCKET *tds)
void tds_free_locale (TDSLOCALE *locale)
void tds_free_msg (TDSMESSAGE *message)
char * tds_alloc_client_sqlstate (int msgno)
char * tds_alloc_lookup_sqlstate (TDSSOCKET *tds, int msgno)
BCPCOLDATAtds_alloc_bcp_column_data (unsigned int column_size)
void tds_free_bcp_column_data (BCPCOLDATA *coldata)
TDSBCPINFOtds_alloc_bcpinfo (void)
void tds_deinit_bcpinfo (TDSBCPINFO *bcpinfo)
void tds_free_bcpinfo (TDSBCPINFO *bcpinfo)
void * tds_realloc (void **pp, size_t new_size)
 Reallocate a pointer and update it if success. More...


static volatile unsigned int inc_num = 1
const TDSCOLUMNFUNCS tds_invalid_funcs
static const TDS_CAPABILITIES defaultcaps

Macro Definition Documentation


#define TEST_CALLOC (   dest,
)     {if (!(dest = (type*)calloc((n), sizeof(type)))) goto Cleanup;}

Definition at line 64 of file mem.c.


#define TEST_MALLOC (   dest,
)     {if (!(dest = (type*)calloc(1, sizeof(type)))) goto Cleanup;}

Definition at line 60 of file mem.c.

Modified on Mon Jun 24 05:22:32 2024 by rev. 669887