ELinks 0.18.0
node.c File Reference
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "dom/node.h"
#include "util/hash.h"
#include "util/memory.h"
Include dependency graph for node.c:

Data Structures

struct  dom_node_search

Macros

#define DOM_NODE_LIST_GRANULARITY   0x7
#define DOM_NODE_LIST_BLOCK_SIZE    (ALIGN_MEMORY_SIZE(1, DOM_NODE_LIST_GRANULARITY) * sizeof(struct dom_node *))
#define DOM_NODE_LIST_SIZE(size)
#define INIT_DOM_NODE_SEARCH(key, list)
#define has_bsearch_node(from, to)
#define set_node_name(name, namelen, str)

Functions

static void done_dom_node_data (struct dom_node *node)
static struct dom_node_listrealloc_dom_node_list (struct dom_node_list **oldlist)
struct dom_node_listadd_to_dom_node_list (struct dom_node_list **list_ptr, struct dom_node *node, int position)
static void del_from_dom_node_list (struct dom_node_list *list, struct dom_node *node)
void done_dom_node_list (struct dom_node_list *list)
int dom_node_casecmp (struct dom_node *node1, struct dom_node *node2)
static int get_bsearch_position (struct dom_node_list *list, int from, int to)
static struct dom_nodedom_node_list_bsearch (struct dom_node_search *search, struct dom_node_list *list)
int get_dom_node_map_index (struct dom_node_list *list, struct dom_node *node)
struct dom_nodeget_dom_node_map_entry (struct dom_node_list *list, uint16_t type, uint16_t subtype, struct dom_string *name)
static int get_dom_node_list_pos (struct dom_node_list *list, struct dom_node *node)
int get_dom_node_list_index (struct dom_node *parent, struct dom_node *node)
struct dom_nodeget_dom_node_prev (struct dom_node *node)
struct dom_nodeget_dom_node_next (struct dom_node *node)
struct dom_nodeget_dom_node_child (struct dom_node *parent, uint16_t type, int16_t subtype)
struct dom_nodeinit_dom_node_at (char *file, int line, struct dom_node *parent, uint16_t type, struct dom_string *string, int allocated)
void done_dom_node (struct dom_node *node)
struct dom_stringget_dom_node_name (struct dom_node *node)
struct dom_stringget_dom_node_value (struct dom_node *node)
struct dom_stringget_dom_node_type_name (uint16_t type)

Macro Definition Documentation

◆ DOM_NODE_LIST_BLOCK_SIZE

#define DOM_NODE_LIST_BLOCK_SIZE    (ALIGN_MEMORY_SIZE(1, DOM_NODE_LIST_GRANULARITY) * sizeof(struct dom_node *))

◆ DOM_NODE_LIST_GRANULARITY

#define DOM_NODE_LIST_GRANULARITY   0x7

◆ DOM_NODE_LIST_SIZE

#define DOM_NODE_LIST_SIZE ( size)
Value:
((size - 1) * sizeof(struct dom_node *) + sizeof(struct dom_node_list))
DOM node list.
Definition node.h:267
DOM node.
Definition node.h:244

◆ has_bsearch_node

#define has_bsearch_node ( from,
to )
Value:
((from) + 1 < (to))

◆ INIT_DOM_NODE_SEARCH

#define INIT_DOM_NODE_SEARCH ( key,
list )
Value:
{ (key), -1, 0, (int)(list)->size, }

◆ set_node_name

#define set_node_name ( name,
namelen,
str )
Value:
do { (name) = (str); (namelen) = sizeof(str) - 1; } while (0)

Function Documentation

◆ add_to_dom_node_list()

struct dom_node_list * add_to_dom_node_list ( struct dom_node_list ** list_ptr,
struct dom_node * node,
int position )

◆ del_from_dom_node_list()

void del_from_dom_node_list ( struct dom_node_list * list,
struct dom_node * node )
static

◆ dom_node_casecmp()

int dom_node_casecmp ( struct dom_node * node1,
struct dom_node * node2 )

◆ dom_node_list_bsearch()

struct dom_node * dom_node_list_bsearch ( struct dom_node_search * search,
struct dom_node_list * list )
inlinestatic

◆ done_dom_node()

void done_dom_node ( struct dom_node * node)

◆ done_dom_node_data()

void done_dom_node_data ( struct dom_node * node)
static

◆ done_dom_node_list()

void done_dom_node_list ( struct dom_node_list * list)

◆ get_bsearch_position()

int get_bsearch_position ( struct dom_node_list * list,
int from,
int to )
inlinestatic

◆ get_dom_node_child()

struct dom_node * get_dom_node_child ( struct dom_node * parent,
uint16_t type,
int16_t subtype )

◆ get_dom_node_list_index()

int get_dom_node_list_index ( struct dom_node * parent,
struct dom_node * node )

◆ get_dom_node_list_pos()

int get_dom_node_list_pos ( struct dom_node_list * list,
struct dom_node * node )
static

◆ get_dom_node_map_entry()

struct dom_node * get_dom_node_map_entry ( struct dom_node_list * list,
uint16_t type,
uint16_t subtype,
struct dom_string * name )

◆ get_dom_node_map_index()

int get_dom_node_map_index ( struct dom_node_list * list,
struct dom_node * node )

◆ get_dom_node_name()

struct dom_string * get_dom_node_name ( struct dom_node * node)

◆ get_dom_node_next()

struct dom_node * get_dom_node_next ( struct dom_node * node)

◆ get_dom_node_prev()

struct dom_node * get_dom_node_prev ( struct dom_node * node)

◆ get_dom_node_type_name()

struct dom_string * get_dom_node_type_name ( uint16_t type)

◆ get_dom_node_value()

struct dom_string * get_dom_node_value ( struct dom_node * node)

◆ init_dom_node_at()

struct dom_node * init_dom_node_at ( char * file,
int line,
struct dom_node * parent,
uint16_t type,
struct dom_string * string,
int allocated )

◆ realloc_dom_node_list()

struct dom_node_list * realloc_dom_node_list ( struct dom_node_list ** oldlist)
inlinestatic