tor  0.4.0.1-alpha
Functions
smartlist_split.c File Reference
#include "lib/smartlist_core/smartlist_core.h"
#include "lib/smartlist_core/smartlist_split.h"
#include "lib/err/torerr.h"
#include "lib/string/util_string.h"
#include "lib/string/compat_ctype.h"
#include "lib/malloc/malloc.h"
#include <string.h>

Go to the source code of this file.

Functions

int smartlist_split_string (smartlist_t *sl, const char *str, const char *sep, int flags, int max)
 

Detailed Description

Split a string into a smartlist_t of substrings.

Definition in file smartlist_split.c.

Function Documentation

◆ smartlist_split_string()

int smartlist_split_string ( smartlist_t sl,
const char *  str,
const char *  sep,
int  flags,
int  max 
)

Split a string str along all occurrences of sep, appending the (newly allocated) split strings, in order, to sl. Return the number of strings added to sl.

If flags&SPLIT_SKIP_SPACE is true, remove initial and trailing space from each entry. If flags&SPLIT_IGNORE_BLANK is true, remove any entries of length 0. If flags&SPLIT_STRIP_SPACE is true, strip spaces from each split string.

If max>0, divide the string into no more than max pieces. If sep is NULL, split on any sequence of horizontal space.

Definition at line 37 of file smartlist_split.c.

Referenced by add_onion_helper_keyarg(), config_register_addressmaps(), dir_split_resource_into_fingerprint_pairs(), format_recommended_version_list(), get_bindaddr_from_transport_listen_line(), get_options_from_transport_options_line(), get_transport_in_state_by_name(), getargs_helper(), handle_control_dropguards(), handle_control_getconf(), handle_control_getinfo(), handle_control_mapaddress(), handle_control_protocolinfo(), handle_control_setevents(), handle_control_usefeature(), nodefamily_canonicalize(), parse_addr_policy(), parse_dir_fallback_line(), rend_parse_service_authorization(), rend_service_parse_port_config(), routerset_parse(), state_transport_line_is_valid(), and string_is_valid_nonrfc_hostname().