Tor 0.4.9.8
Loading...
Searching...
No Matches
cstring.c File Reference

Decode data that has been written as a C literal. More...

#include "lib/encoding/cstring.h"
#include "lib/log/log.h"
#include "lib/log/util_bug.h"
#include "lib/malloc/malloc.h"
#include "lib/string/compat_ctype.h"
#include <string.h>

Go to the source code of this file.

Macros

#define TOR_ISODIGIT(c)
 

Functions

const char * unescape_string (const char *s, char **result, size_t *size_out)
 

Detailed Description

Decode data that has been written as a C literal.

Definition in file cstring.c.

Macro Definition Documentation

◆ TOR_ISODIGIT

#define TOR_ISODIGIT ( c)
Value:
('0' <= (c) && (c) <= '7')

Definition at line 21 of file cstring.c.

Function Documentation

◆ unescape_string()

const char * unescape_string ( const char * s,
char ** result,
size_t * size_out )

Given a c-style double-quoted escaped string in s, extract and decode its contents into a newly allocated string. On success, assign this string to *result, assign its length to size_out (if provided), and return a pointer to the position in s immediately after the string. On failure, return NULL.

Definition at line 30 of file cstring.c.

Referenced by kvline_parse(), parse_config_line_from_str_verbose(), and port_cfg_line_extract_addrport().