NetSurf
Macros | Functions
corestrings.c File Reference

Useful interned string tables implementation. More...

#include <dom/dom.h>
#include "utils/corestrings.h"
#include "utils/nsurl.h"
#include "utils/utils.h"
#include "utils/corestringlist.h"
Include dependency graph for corestrings.c:

Go to the source code of this file.

Macros

#define CORESTRING_LWC_VALUE(NAME, VALUE)   lwc_string *corestring_lwc_##NAME
 
#define CORESTRING_DOM_VALUE(NAME, VALUE)   dom_string *corestring_dom_##NAME
 
#define CORESTRING_NSURL(NAME, VALUE)   nsurl *corestring_nsurl_##NAME
 
#define CORESTRING_LWC_VALUE(NAME, VALUE)
 
#define CORESTRING_DOM_VALUE(NAME, VALUE)
 
#define CORESTRING_NSURL(NAME, VALUE)
 
#define CORESTRING_LWC_VALUE(NAME, VALUE)
 
#define CORESTRING_DOM_VALUE(NAME, VALUE)
 
#define CORESTRING_NSURL(NAME, VALUE)
 

Functions

nserror corestrings_fini (void)
 free resources of core string tables. More...
 
nserror corestrings_init (void)
 Initialise the core string tables. More...
 

Detailed Description

Useful interned string tables implementation.

Definition in file corestrings.c.

Macro Definition Documentation

◆ CORESTRING_DOM_VALUE [1/3]

#define CORESTRING_DOM_VALUE (   NAME,
  VALUE 
)    dom_string *corestring_dom_##NAME

Definition at line 32 of file corestrings.c.

◆ CORESTRING_DOM_VALUE [2/3]

#define CORESTRING_DOM_VALUE (   NAME,
  VALUE 
)
Value:
do { \
if (corestring_dom_##NAME != NULL) { \
dom_string_unref(corestring_dom_##NAME); \
corestring_dom_##NAME = NULL; \
} \
} while (0)

Definition at line 32 of file corestrings.c.

◆ CORESTRING_DOM_VALUE [3/3]

#define CORESTRING_DOM_VALUE (   NAME,
  VALUE 
)
Value:
do { \
exc = dom_string_create_interned( \
(const uint8_t *)VALUE, \
sizeof(VALUE) - 1, \
&corestring_dom_##NAME ); \
if ((exc != DOM_NO_ERR) || \
(corestring_dom_##NAME == NULL)) { \
error = NSERROR_NOMEM; \
goto error; \
} \
} while(0)
@ NSERROR_NOMEM
Memory exhaustion.
Definition: errors.h:32

Definition at line 32 of file corestrings.c.

◆ CORESTRING_LWC_VALUE [1/3]

#define CORESTRING_LWC_VALUE (   NAME,
  VALUE 
)    lwc_string *corestring_lwc_##NAME

Definition at line 31 of file corestrings.c.

◆ CORESTRING_LWC_VALUE [2/3]

#define CORESTRING_LWC_VALUE (   NAME,
  VALUE 
)
Value:
do { \
if (corestring_lwc_##NAME != NULL) { \
lwc_string_unref(corestring_lwc_##NAME); \
corestring_lwc_##NAME = NULL; \
} \
} while (0)

Definition at line 31 of file corestrings.c.

◆ CORESTRING_LWC_VALUE [3/3]

#define CORESTRING_LWC_VALUE (   NAME,
  VALUE 
)
Value:
do { \
lerror = lwc_intern_string( \
(const char *)VALUE, \
sizeof(VALUE) - 1, \
&corestring_lwc_##NAME ); \
if ((lerror != lwc_error_ok) || \
(corestring_lwc_##NAME == NULL)) { \
error = NSERROR_NOMEM; \
goto error; \
} \
} while(0)

Definition at line 31 of file corestrings.c.

◆ CORESTRING_NSURL [1/3]

#define CORESTRING_NSURL (   NAME,
  VALUE 
)    nsurl *corestring_nsurl_##NAME

Definition at line 33 of file corestrings.c.

◆ CORESTRING_NSURL [2/3]

#define CORESTRING_NSURL (   NAME,
  VALUE 
)
Value:
do { \
if (corestring_nsurl_##NAME != NULL) { \
nsurl_unref(corestring_nsurl_##NAME); \
corestring_nsurl_##NAME = NULL; \
} \
} while (0)

Definition at line 33 of file corestrings.c.

◆ CORESTRING_NSURL [3/3]

#define CORESTRING_NSURL (   NAME,
  VALUE 
)
Value:
do { \
error = nsurl_create(VALUE, \
&corestring_nsurl_##NAME); \
if (error != NSERROR_OK) { \
goto error; \
} \
} while(0)
@ NSERROR_OK
No error.
Definition: errors.h:30
nserror nsurl_create(const char *const url_s, nsurl **url)
Create a NetSurf URL object from a URL string.

Definition at line 33 of file corestrings.c.

Function Documentation

◆ corestrings_fini()

nserror corestrings_fini ( void  )

free resources of core string tables.

Returns
NSERROR_OK on success else appropriate error code

Definition at line 40 of file corestrings.c.

References NSERROR_OK.

Referenced by corestrings_init(), and netsurf_exit().

Here is the caller graph for this function:

◆ corestrings_init()

nserror corestrings_init ( void  )

Initialise the core string tables.

Returns
NSERROR_OK on success else appropriate error code

Definition at line 78 of file corestrings.c.

References corestrings_fini(), and NSERROR_OK.

Referenced by netsurf_init().

Here is the call graph for this function:
Here is the caller graph for this function: