Ruby  2.4.2p198(2017-09-14revision59899)
Macros | Functions | Variables
escape.c File Reference
#include "ruby.h"
#include "ruby/encoding.h"
Include dependency graph for escape.c:

Go to the source code of this file.

Macros

#define lower_hexdigits   (ruby_hexdigits+0)
 
#define upper_hexdigits   (ruby_hexdigits+16)
 
#define char_to_number(c)   ruby_digit36_to_number_table[(unsigned char)(c)]
 
#define MATCH(s)
 

Functions

RUBY_EXTERN unsigned long ruby_scan_digits (const char *str, ssize_t len, int base, size_t *retlen, int *overflow)
 
static void html_escaped_cat (VALUE str, char c)
 
static void preserve_original_state (VALUE orig, VALUE dest)
 
static VALUE optimized_escape_html (VALUE str)
 
static VALUE optimized_unescape_html (VALUE str)
 
static unsigned char url_unreserved_char (unsigned char c)
 
static VALUE optimized_escape (VALUE str)
 
static VALUE optimized_unescape (VALUE str, VALUE encoding)
 
static VALUE cgiesc_escape_html (VALUE self, VALUE str)
 
static VALUE cgiesc_unescape_html (VALUE self, VALUE str)
 
static VALUE cgiesc_escape (VALUE self, VALUE str)
 
static VALUE accept_charset (int argc, VALUE *argv, VALUE self)
 
static VALUE cgiesc_unescape (int argc, VALUE *argv, VALUE self)
 
void Init_escape (void)
 
void InitVM_escape (void)
 

Variables

RUBY_EXTERN const char ruby_hexdigits []
 
RUBY_EXTERN const signed char ruby_digit36_to_number_table []
 
static VALUE rb_cCGI
 
static VALUE rb_mUtil
 
static VALUE rb_mEscape
 
static ID id_accept_charset
 

Macro Definition Documentation

◆ char_to_number

#define char_to_number (   c)    ruby_digit36_to_number_table[(unsigned char)(c)]

Definition at line 9 of file escape.c.

Referenced by optimized_unescape().

◆ lower_hexdigits

#define lower_hexdigits   (ruby_hexdigits+0)

Definition at line 7 of file escape.c.

◆ MATCH

#define MATCH (   s)
Value:
(len - i >= (int)rb_strlen_lit(s) && \
memcmp(&cstr[i], s, rb_strlen_lit(s)) == 0 && \
(i += rb_strlen_lit(s) - 1, 1))
#define rb_strlen_lit(str)
Definition: intern.h:867
register unsigned int len
Definition: zonetab.h:51

Referenced by obj_type(), optimized_unescape_html(), and vm_init_redefined_flag().

◆ upper_hexdigits

#define upper_hexdigits   (ruby_hexdigits+16)

Definition at line 8 of file escape.c.

Referenced by optimized_escape().

Function Documentation

◆ accept_charset()

static VALUE accept_charset ( int  argc,
VALUE argv,
VALUE  self 
)
static

Definition at line 373 of file escape.c.

References CLASS_OF, id_accept_charset, and rb_cvar_get().

Referenced by cgiesc_unescape().

◆ cgiesc_escape()

static VALUE cgiesc_escape ( VALUE  self,
VALUE  str 
)
static

Definition at line 360 of file escape.c.

References optimized_escape(), rb_call_super(), rb_enc_str_asciicompat_p, and StringValue.

Referenced by InitVM_escape().

◆ cgiesc_escape_html()

static VALUE cgiesc_escape_html ( VALUE  self,
VALUE  str 
)
static

Definition at line 320 of file escape.c.

References optimized_escape_html(), rb_call_super(), rb_enc_str_asciicompat_p, and StringValue.

Referenced by InitVM_escape().

◆ cgiesc_unescape()

static VALUE cgiesc_unescape ( int  argc,
VALUE argv,
VALUE  self 
)
static

◆ cgiesc_unescape_html()

static VALUE cgiesc_unescape_html ( VALUE  self,
VALUE  str 
)
static

Definition at line 340 of file escape.c.

References optimized_unescape_html(), rb_call_super(), rb_enc_str_asciicompat_p, and StringValue.

Referenced by InitVM_escape().

◆ html_escaped_cat()

static void html_escaped_cat ( VALUE  str,
char  c 
)
static

Definition at line 15 of file escape.c.

References rb_str_cat_cstr().

Referenced by optimized_escape_html().

◆ Init_escape()

void Init_escape ( void  )

Definition at line 404 of file escape.c.

References id_accept_charset, InitVM, and rb_intern_const.

◆ InitVM_escape()

void InitVM_escape ( void  )

◆ optimized_escape()

static VALUE optimized_escape ( VALUE  str)
static

◆ optimized_escape_html()

static VALUE optimized_escape_html ( VALUE  str)
static

◆ optimized_unescape()

static VALUE optimized_unescape ( VALUE  str,
VALUE  encoding 
)
static

◆ optimized_unescape_html()

static VALUE optimized_unescape_html ( VALUE  str)
static

◆ preserve_original_state()

static void preserve_original_state ( VALUE  orig,
VALUE  dest 
)
inlinestatic

◆ ruby_scan_digits()

RUBY_EXTERN unsigned long ruby_scan_digits ( const char *  str,
ssize_t  len,
int  base,
size_t *  retlen,
int *  overflow 
)

◆ url_unreserved_char()

static unsigned char url_unreserved_char ( unsigned char  c)
static

Definition at line 189 of file escape.c.

Referenced by optimized_escape().

Variable Documentation

◆ id_accept_charset

ID id_accept_charset
static

Definition at line 12 of file escape.c.

Referenced by accept_charset(), and Init_escape().

◆ rb_cCGI

VALUE rb_cCGI
static

Definition at line 11 of file escape.c.

Referenced by InitVM_escape().

◆ rb_mEscape

VALUE rb_mEscape
static

Definition at line 11 of file escape.c.

Referenced by InitVM_escape().

◆ rb_mUtil

VALUE rb_mUtil
static

Definition at line 11 of file escape.c.

Referenced by InitVM_escape().

◆ ruby_digit36_to_number_table

RUBY_EXTERN const signed char ruby_digit36_to_number_table[]

Definition at line 6 of file escape.c.

Referenced by hex2num().

◆ ruby_hexdigits

RUBY_EXTERN const char ruby_hexdigits[]

Definition at line 5 of file escape.c.