YAZ  5.23.1
Functions
nmemsdup.c File Reference

Implements NMEM dup utilities. More...

#include <string.h>
#include <yaz/nmem_xml.h>

Go to the source code of this file.

Functions

char * nmem_strdup (NMEM mem, const char *src)
 allocates string on NMEM handle (similar strdup) More...
 
char * nmem_strdup_null (NMEM mem, const char *src)
 allocates string on NMEM handle - allows NULL ptr buffer More...
 
char * nmem_strdupn (NMEM mem, const char *src, size_t n)
 allocates string of certain size on NMEM handle More...
 
nmem_int_tnmem_intdup (NMEM mem, nmem_int_t v)
 allocates and sets integer for NMEM More...
 
nmem_bool_tnmem_booldup (NMEM mem, nmem_bool_t v)
 allocates and sets boolean for NMEM More...
 
void nmem_strsplit_blank (NMEM nmem, const char *dstr, char ***darray, int *num)
 splits string into sub strings delimited by blanks More...
 
void nmem_strsplit (NMEM nmem, const char *delim, const char *dstr, char ***darray, int *num)
 allocates sub strings out of string using certain delimitors More...
 
void nmem_strsplitx (NMEM nmem, const char *delim, const char *dstr, char ***darray, int *num, int collapse)
 allocates sub strings out of string using certain delimitors More...
 
void nmem_strsplit_escape (NMEM nmem, const char *delim, const char *dstr, char ***darray, int *num, int collapse, int escape_char)
 allocates sub strings out of string using certain delimitors More...
 
void nmem_strsplit_escape2 (NMEM nmem, const char *delim, const char *dstr, char ***darray, int *num, int collapse, int escape_char, int subst_escape)
 allocates sub strings out of string using certain delimitors More...
 
char * nmem_text_node_cdata (const xmlNode *ptr_cdata, NMEM nmem)
 copies TEXT Libxml2 node data to NMEM More...
 

Detailed Description

Implements NMEM dup utilities.

Definition in file nmemsdup.c.

Function Documentation

nmem_bool_t* nmem_booldup ( NMEM  nmem,
nmem_bool_t  v 
)

allocates and sets boolean for NMEM

Parameters
nmemNMEM handle
vvalue (0=false, != 0 true)
Returns
pointer to created boolean

Definition at line 48 of file nmemsdup.c.

References nmem_malloc().

Referenced by match_v_next(), and odr_booldup().

nmem_int_t* nmem_intdup ( NMEM  nmem,
nmem_int_t  v 
)

allocates and sets integer for NMEM

Parameters
nmemNMEM handle
vinteger value
Returns
pointer to created integer

Definition at line 41 of file nmemsdup.c.

References nmem_malloc().

Referenced by cql_transform_parse_tok_line(), and odr_intdup().

char* nmem_strdup ( NMEM  mem,
const char *  src 
)
char* nmem_strdup_null ( NMEM  mem,
const char *  src 
)

allocates string on NMEM handle - allows NULL ptr buffer

Parameters
memHNEM handle
srcstring
Returns
duplicated string or NULL if src was NULL

Definition at line 25 of file nmemsdup.c.

References nmem_strdup().

Referenced by gfs_server_new(), and odr_strdup_null().

char* nmem_strdupn ( NMEM  mem,
const char *  src,
size_t  n 
)

allocates string of certain size on NMEM handle

Parameters
memNMEM handle
srcstring
nsize of string
Returns
duplicated string (0 terminated)

Definition at line 33 of file nmemsdup.c.

References nmem_malloc().

Referenced by extract_user_pass(), nmem_strsplit_escape2(), odr_strdupn(), yaz_marc_add_controlfield(), yaz_marc_add_datafield(), yaz_marc_add_leader(), yaz_marc_add_subfield(), and yaz_record_render().

void nmem_strsplit ( NMEM  nmem,
const char *  delim,
const char *  dstr,
char ***  darray,
int *  num 
)

allocates sub strings out of string using certain delimitors

Parameters
nmemNMEM handle
delimdelimitor chars (splits on each char in there)
dstrstring to be split
darrayresult string array for each sub string
numnumber of result strings

Definition at line 61 of file nmemsdup.c.

References nmem_strsplitx().

Referenced by nmem_strsplit_blank(), xml_config_read(), yaz_pqf_parse_facet_list(), yaz_set_proposal_charneg_list(), yaz_solr_sortkeys_to_sort_spec(), and ZOOM_connection_get_databases().

void nmem_strsplit_blank ( NMEM  nmem,
const char *  dstr,
char ***  darray,
int *  num 
)

splits string into sub strings delimited by blanks

Parameters
nmemNMEM handle
dstrstring to be split
darrayresult string array for each sub string
numnumber of result strings

Definition at line 55 of file nmemsdup.c.

References nmem_strsplit().

Referenced by yaz_srw_sortkeys_to_sort_spec(), and ZOOM_memcached_destroy().

void nmem_strsplit_escape ( NMEM  nmem,
const char *  delim,
const char *  dstr,
char ***  darray,
int *  num,
int  collapse,
int  escape_char 
)

allocates sub strings out of string using certain delimitors

Parameters
nmemNMEM handle
delimdelimitor chars (splits on each char in there)
dstrstring to be split
darrayresult string array for each sub string
numnumber of result strings
collapse1=collapse multiple delims to one; 0=no collapse
escape_char!= 0, an escape char (could be )

Definition at line 73 of file nmemsdup.c.

References nmem_strsplit_escape2().

Referenced by nmem_strsplitx().

void nmem_strsplit_escape2 ( NMEM  nmem,
const char *  delim,
const char *  dstr,
char ***  darray,
int *  num,
int  collapse,
int  escape_char,
int  subst_escape 
)

allocates sub strings out of string using certain delimitors

Parameters
nmemNMEM handle
delimdelimitor chars (splits on each char in there)
dstrstring to be split
darrayresult string array for each sub string
numnumber of result strings
collapse1=collapse multiple delims to one; 0=no collapse
escape_char!= 0, an escape char (could be )
subst_escape1=substitute escapes, 0 leave as is

Definition at line 81 of file nmemsdup.c.

References nmem_malloc(), and nmem_strdupn().

Referenced by nmem_strsplit_escape().

void nmem_strsplitx ( NMEM  nmem,
const char *  delim,
const char *  dstr,
char ***  darray,
int *  num,
int  collapse 
)

allocates sub strings out of string using certain delimitors

Parameters
nmemNMEM handle
delimdelimitor chars (splits on each char in there)
dstrstring to be split
darrayresult string array for each sub string
numnumber of result strings
collapse1=collapse multiple delims to one; 0=no collapse

Definition at line 67 of file nmemsdup.c.

References nmem_strsplit_escape().

Referenced by nmem_strsplit(), yaz_solr_sortkeys_to_sort_spec(), and yaz_srw_sortkeys_to_sort_spec().

char* nmem_text_node_cdata ( const xmlNode *  ptr_cdata,
NMEM  nmem 
)