#include <stddef.h>
#include <yaz/yconfig.h>
Go to the source code of this file.
Typedefs | |
| typedef struct nmem_control * | NMEM |
| NMEM handle (an opaque pointer to memory). | |
Functions | |
| void | nmem_reset (NMEM n) |
| releases memory associaged with an NMEM handle | |
| int | nmem_total (NMEM n) |
| returns size in bytes of memory for NMEM handle | |
| char * | nmem_strdup (NMEM mem, const char *src) |
| allocates string on NMEM handle (similar strdup) | |
| char * | nmem_strdup_null (NMEM mem, const char *src) |
| allocates string on NMEM handle - allows NULL ptr buffer | |
| char * | nmem_strdupn (NMEM mem, const char *src, size_t n) |
| allocates string of certain size on NMEM handle | |
| void | nmem_strsplit (NMEM nmem, const char *delim, const char *dstr, char ***darray, int *num) |
| allocates sub strings out of string using certain delimitors | |
| void | nmem_strsplit_blank (NMEM nmem, const char *dstr, char ***darray, int *num) |
| splits string into sub strings delimited by blanks | |
| int * | nmem_intdup (NMEM nmem, int v) |
| allocates integer for NMEM | |
| void | nmem_transfer (NMEM dst, NMEM src) |
| transfers memory from one NMEM handle to another | |
| NMEM | nmem_create (void) |
| returns new NMEM handle | |
| void | nmem_destroy (NMEM n) |
| destroys NMEM handle and memory associated with it | |
| void * | nmem_malloc (NMEM n, int size) |
| allocates memory block on NMEM handle | |
| int | yaz_errno (void) |
| void | yaz_set_errno (int v) |
| void | yaz_strerror (char *buf, int max) |
This is a simple and fairly wasteful little module for nibble memory allocation. Eventually we'll put in something better.
Definition in file nmem.h.
| typedef struct nmem_control* NMEM |
| NMEM nmem_create | ( | void | ) |
returns new NMEM handle
Definition at line 147 of file nmem.c.
References nmem_control::blocks, nmem_control::next, nmem_control::total, xmalloc, and yaz_log_module_level().
Referenced by bend_request_mk(), ccl_stop_words_create(), cql_parser_create(), cql_transform(), cql_transform_create(), odr_createmem(), odr_extract_mem(), yaz_marc_create(), and yaz_record_conv_create().
| void nmem_destroy | ( | NMEM | n | ) |
destroys NMEM handle and memory associated with it
| n | NMEM handle |
Definition at line 165 of file nmem.c.
References nmem_reset(), and xfree.
Referenced by bend_request_destroy(), ccl_stop_words_destroy(), cql_parser_destroy(), cql_transform(), cql_transform_close(), ir_session(), odr_destroy(), yaz_marc_destroy(), and yaz_record_conv_destroy().
| int* nmem_intdup | ( | NMEM | nmem, | |
| int | v | |||
| ) |
allocates integer for NMEM
| nmem | NMEM handle | |
| v | integer value |
Definition at line 41 of file nmemsdup.c.
References nmem_malloc().
Referenced by odr_intdup().
| void* nmem_malloc | ( | NMEM | n, | |
| int | size | |||
| ) |
allocates memory block on NMEM handle
| n | NMEM handle | |
| size | number of bytes to be allocated |
Definition at line 118 of file nmem.c.
References nmem_control::blocks, nmem_block::buf, nmem_block::next, NMEM_ALIGN, nmem_block::size, nmem_block::top, nmem_control::total, yaz_log(), and YLOG_FATAL.
Referenced by cql_node_mk_boolean(), cql_node_mk_sc(), nmem_intdup(), nmem_strdup(), nmem_strdupn(), nmem_strsplit(), nmem_text_node_cdata(), odr_getoidbystr_nmem(), odr_malloc(), odr_oiddup_nmem(), save_referenceId(), yaz_get_proposal_charneg(), yaz_get_response_charneg(), yaz_marc_add_subfield(), yaz_marc_read_xml_subfields(), yaz_set_esn(), and yylex().
| void nmem_reset | ( | NMEM | n | ) |
releases memory associaged with an NMEM handle
| n | NMEM handle |
Definition at line 102 of file nmem.c.
References nmem_control::blocks, nmem_block::next, nmem_control::total, and yaz_log().
Referenced by ccl_stop_words_tree(), cql_parser_stream(), nmem_destroy(), odr_reset(), and yaz_marc_reset().
| char* nmem_strdup | ( | NMEM | mem, | |
| const char * | src | |||
| ) |
allocates string on NMEM handle (similar strdup)
| mem | HNEM handle | |
| src | string |
Definition at line 18 of file nmemsdup.c.
References nmem_malloc().
Referenced by cql_apply_prefix(), cql_node_dup(), cql_node_mk_boolean(), cql_node_mk_sc(), nmem_strdup_null(), odr_strdup(), yaz_get_proposal_charneg(), yaz_get_response_charneg(), yaz_marc_add_comment(), yaz_marc_add_controlfield(), yaz_marc_add_datafield(), yaz_set_esn(), and yyparse().
| char* nmem_strdup_null | ( | NMEM | mem, | |
| const char * | src | |||
| ) |
allocates string on NMEM handle - allows NULL ptr buffer
| mem | HNEM handle | |
| src | string |
Definition at line 25 of file nmemsdup.c.
References nmem_strdup().
Referenced by odr_strdup_null().
| char* nmem_strdupn | ( | NMEM | mem, | |
| const char * | src, | |||
| size_t | n | |||
| ) |
allocates string of certain size on NMEM handle
| mem | NMEM handle | |
| src | string | |
| n | size of string |
Definition at line 33 of file nmemsdup.c.
References nmem_malloc().
Referenced by nmem_strsplit(), odr_strdupn(), yaz_marc_add_controlfield(), yaz_marc_add_datafield(), yaz_marc_add_datafield_xml(), yaz_marc_add_leader(), and yaz_marc_add_subfield().
| void nmem_strsplit | ( | NMEM | nmem, | |
| const char * | delim, | |||
| const char * | dstr, | |||
| char *** | darray, | |||
| int * | num | |||
| ) |
allocates sub strings out of string using certain delimitors
| nmem | NMEM handle | |
| delim | delimitor chars (splits on each char in there) | |
| dstr | string to be split | |
| darray | result string array for each sub string | |
| num | number of result strings |
Definition at line 53 of file nmemsdup.c.
References nmem_malloc(), and nmem_strdupn().
Referenced by nmem_strsplit_blank(), and yaz_set_proposal_charneg_list().
| void nmem_strsplit_blank | ( | NMEM | nmem, | |
| const char * | dstr, | |||
| char *** | darray, | |||
| int * | num | |||
| ) |
splits string into sub strings delimited by blanks
| nmem | NMEM handle | |
| dstr | string to be split | |
| darray | result string array for each sub string | |
| num | number of result strings |
Definition at line 48 of file nmemsdup.c.
References nmem_strsplit().
| int nmem_total | ( | NMEM | n | ) |
returns size in bytes of memory for NMEM handle
Definition at line 142 of file nmem.c.
References nmem_control::total.
Referenced by odr_total().
transfers memory from one NMEM handle to another
| src | source NMEM handle | |
| dst | destination NMEM handle |
Definition at line 174 of file nmem.c.
References nmem_control::blocks, nmem_block::next, and nmem_control::total.
Referenced by yaz_copy_Z_Query(), and yaz_copy_z_RPNQuery().
| int yaz_errno | ( | void | ) |
Definition at line 187 of file nmem.c.
Referenced by iochan_event_loop(), tcpip_listen(), yaz_iconv(), and yaz_strerror().
| void yaz_strerror | ( | char * | buf, | |
| int | max | |||
| ) |
Definition at line 197 of file nmem.c.
References yaz_errno(), and yaz_log_module_level().
Referenced by yaz_log().
1.5.6