MCPcopy Create free account
hub / github.com/git/git / create_token_tree

Function create_token_tree

compat/regex/regcomp.c:3778–3810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3776/* Functions for binary tree operation. */
3777
3778/* Create a tree node. */
3779
3780static bin_tree_t *
3781create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
3782 re_token_type_t type)
3783{
3784 re_token_t t;
3785 t.type = type;
3786 return create_token_tree (dfa, left, right, &t);
3787}
3788
3789static bin_tree_t *
3790create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
3791 const re_token_t *token)
3792{
3793 bin_tree_t *tree;
3794 if (BE (dfa->str_tree_storage_idx == BIN_TREE_STORAGE_SIZE, 0))
3795 {
3796 bin_tree_storage_t *storage = re_malloc (bin_tree_storage_t, 1);
3797
3798 if (storage == NULL)
3799 return NULL;
3800 storage->next = dfa->str_tree_storage;
3801 dfa->str_tree_storage = storage;
3802 dfa->str_tree_storage_idx = 0;
3803 }
3804 tree = &dfa->str_tree_storage->data[dfa->str_tree_storage_idx++];
3805
3806 tree->parent = NULL;
3807 tree->left = left;
3808 tree->right = right;
3809 tree->token = *token;
3810 tree->token.duplicated = 0;
3811 tree->token.opt_subexp = 0;
3812 tree->first = NULL;
3813 tree->next = NULL;

Callers 5

parse_expressionFunction · 0.85
parse_bracket_expFunction · 0.85
build_charclass_opFunction · 0.85
create_treeFunction · 0.85
duplicate_treeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected