Tor  0.4.3.0-alpha-dev
Macros | Functions | Variables
compat_ctype.h File Reference

Locale-independent character-type inspection (header) More...

#include "orconfig.h"
#include "lib/cc/torint.h"

Go to the source code of this file.

Macros

#define DECLARE_CTYPE_FN(name)
 
#define TOR_TOLOWER(c)   (TOR_TOLOWER_TABLE[(uint8_t)c])
 
#define TOR_TOUPPER(c)   (TOR_TOUPPER_TABLE[(uint8_t)c])
 

Functions

static int hex_decode_digit (char c)
 

Variables

const uint8_t TOR_TOUPPER_TABLE []
 
const uint8_t TOR_TOLOWER_TABLE []
 

Detailed Description

Locale-independent character-type inspection (header)

Definition in file compat_ctype.h.

Macro Definition Documentation

◆ DECLARE_CTYPE_FN

#define DECLARE_CTYPE_FN (   name)
Value:
static int TOR_##name(char c); \
extern const uint32_t TOR_##name##_TABLE[]; \
static inline int TOR_##name(char c) { \
uint8_t u = c; \
return !!(TOR_##name##_TABLE[(u >> 5) & 7] & (1u << (u & 31))); \
}
const char * name
Definition: config.c:2211

Definition at line 19 of file compat_ctype.h.

Function Documentation

◆ hex_decode_digit()

static int hex_decode_digit ( char  c)
inlinestatic

Helper: given a hex digit, return its value, or -1 if it isn't hex.

Definition at line 43 of file compat_ctype.h.

Referenced by base16_decode(), and tor_addr_parse_PTR_name().

Variable Documentation

◆ TOR_TOUPPER_TABLE

const uint8_t TOR_TOUPPER_TABLE[]

Upper-casing and lowercasing tables to map characters to upper/lowercase equivalents. Used by tor_toupper() and tor_tolower().

Definition at line 36 of file compat_ctype.c.