Ruby  2.1.10p492(2016-04-01revision54464)
Data Structures | Macros | Typedefs | Functions | Variables
marshal.c File Reference
#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/st.h"
#include "ruby/util.h"
#include "ruby/encoding.h"
#include "internal.h"
#include <math.h>

Go to the source code of this file.

Data Structures

struct  marshal_compat_t
 
struct  dump_arg
 
struct  dump_call_arg
 
struct  load_arg
 

Macros

#define BITSPERSHORT   (2*CHAR_BIT)
 
#define SHORTMASK   ((1<<BITSPERSHORT)-1)
 
#define SHORTDN(x)   RSHIFT((x),BITSPERSHORT)
 
#define SHORTLEN(x)   (x)
 
#define MARSHAL_MAJOR   4
 
#define MARSHAL_MINOR   8
 
#define TYPE_NIL   '0'
 
#define TYPE_TRUE   'T'
 
#define TYPE_FALSE   'F'
 
#define TYPE_FIXNUM   'i'
 
#define TYPE_EXTENDED   'e'
 
#define TYPE_UCLASS   'C'
 
#define TYPE_OBJECT   'o'
 
#define TYPE_DATA   'd'
 
#define TYPE_USERDEF   'u'
 
#define TYPE_USRMARSHAL   'U'
 
#define TYPE_FLOAT   'f'
 
#define TYPE_BIGNUM   'l'
 
#define TYPE_STRING   '"'
 
#define TYPE_REGEXP   '/'
 
#define TYPE_ARRAY   '['
 
#define TYPE_HASH   '{'
 
#define TYPE_HASH_DEF   '}'
 
#define TYPE_STRUCT   'S'
 
#define TYPE_MODULE_OLD   'M'
 
#define TYPE_CLASS   'c'
 
#define TYPE_MODULE   'm'
 
#define TYPE_SYMBOL   ':'
 
#define TYPE_SYMLINK   ';'
 
#define TYPE_IVAR   'I'
 
#define TYPE_LINK   '@'
 
#define MARSHAL_INFECTION   FL_TAINT
 
#define w_cstr(s, arg)   w_bytes((s), strlen(s), (arg))
 
#define load_mantissa(d, buf, len)   (d)
 
#define FLOAT_DIG   17
 
#define SINGLETON_DUMP_UNABLE_P(klass)
 
#define has_ivars(obj, ivtbl)
 
#define r_entry(v, arg)   r_entry0((v), (arg)->data->num_entries, (arg))
 
#define SIGN_EXTEND_CHAR(c)   ((((unsigned char)(c)) ^ 128) - 128)
 
#define r_bytes(arg)   r_bytes0(r_long(arg), (arg))
 
#define path2module(path)   must_be_module(rb_path_to_class(path), path)
 
#define prohibit_ivar(type, str)
 
#define rb_intern(str)   rb_intern_const(str)
 

Typedefs

typedef char ruby_check_marshal_viral_flags [MARSHAL_INFECTION==(int) MARSHAL_INFECTION?1:-1]
 

Functions

static int mark_marshal_compat_i (st_data_t key, st_data_t value)
 
static void mark_marshal_compat_t (void *tbl)
 
static st_tablecompat_allocator_table (void)
 
void rb_marshal_define_compat (VALUE newclass, VALUE oldclass, VALUE(*dumper)(VALUE), VALUE(*loader)(VALUE, VALUE))
 
static void check_dump_arg (struct dump_arg *arg, ID sym)
 
static void clear_dump_arg (struct dump_arg *arg)
 
static void mark_dump_arg (void *ptr)
 
static void free_dump_arg (void *ptr)
 
static size_t memsize_dump_arg (const void *ptr)
 
static const char * must_not_be_anonymous (const char *type, VALUE path)
 
static VALUE class2path (VALUE klass)
 
static void w_long (long, struct dump_arg *)
 
static void w_encoding (VALUE obj, long num, struct dump_call_arg *arg)
 
static void w_nbyte (const char *s, long n, struct dump_arg *arg)
 
static void w_byte (char c, struct dump_arg *arg)
 
static void w_bytes (const char *s, long n, struct dump_arg *arg)
 
static void w_short (int x, struct dump_arg *arg)
 
static void w_float (double d, struct dump_arg *arg)
 
static void w_symbol (ID id, struct dump_arg *arg)
 
static void w_unique (VALUE s, struct dump_arg *arg)
 
static void w_object (VALUE, struct dump_arg *, int)
 
static int hash_each (VALUE key, VALUE value, struct dump_call_arg *arg)
 
static void w_extended (VALUE klass, struct dump_arg *arg, int check)
 
static void w_class (char type, VALUE obj, struct dump_arg *arg, int check)
 
static void w_uclass (VALUE obj, VALUE super, struct dump_arg *arg)
 
static int w_obj_each (st_data_t key, st_data_t val, st_data_t a)
 
static void w_ivar (VALUE obj, st_table *tbl, struct dump_call_arg *arg)
 
static void w_objivar (VALUE obj, struct dump_call_arg *arg)
 
 NORETURN (static inline void io_needed(void))
 
static void io_needed (void)
 
static VALUE marshal_dump (int argc, VALUE *argv)
 
static void check_load_arg (struct load_arg *arg, ID sym)
 
static void clear_load_arg (struct load_arg *arg)
 
static void mark_load_arg (void *ptr)
 
static void free_load_arg (void *ptr)
 
static size_t memsize_load_arg (const void *ptr)
 
static VALUE r_entry0 (VALUE v, st_index_t num, struct load_arg *arg)
 
static VALUE r_object (struct load_arg *arg)
 
static ID r_symbol (struct load_arg *arg)
 
static VALUE path2class (VALUE path)
 
 NORETURN (static void too_short(void))
 
static void too_short (void)
 
static st_index_t r_prepare (struct load_arg *arg)
 
static unsigned char r_byte1_buffered (struct load_arg *arg)
 
static int r_byte (struct load_arg *arg)
 
static void long_toobig (int size)
 
static long r_long (struct load_arg *arg)
 
static VALUE r_bytes1 (long len, struct load_arg *arg)
 
static VALUE r_bytes1_buffered (long len, struct load_arg *arg)
 
static VALUE r_bytes0 (long len, struct load_arg *arg)
 
static int id2encidx (ID id, VALUE val)
 
static ID r_symlink (struct load_arg *arg)
 
static ID r_symreal (struct load_arg *arg, int ivar)
 
static VALUE r_unique (struct load_arg *arg)
 
static VALUE r_string (struct load_arg *arg)
 
static VALUE r_fixup_compat (VALUE v, struct load_arg *arg)
 
static VALUE r_post_proc (VALUE v, struct load_arg *arg)
 
static VALUE r_leave (VALUE v, struct load_arg *arg)
 
static int copy_ivar_i (st_data_t key, st_data_t val, st_data_t arg)
 
static VALUE r_copy_ivar (VALUE v, VALUE data)
 
static void r_ivar (VALUE obj, int *has_encoding, struct load_arg *arg)
 
static VALUE must_be_module (VALUE v, VALUE path)
 
static VALUE obj_alloc_by_klass (VALUE klass, struct load_arg *arg, VALUE *oldclass)
 
static VALUE obj_alloc_by_path (VALUE path, struct load_arg *arg)
 
static VALUE append_extmod (VALUE obj, VALUE extmod)
 
static VALUE r_object0 (struct load_arg *arg, int *ivp, VALUE extmod)
 
static VALUE marshal_load (int argc, VALUE *argv)
 
void Init_marshal (void)
 
VALUE rb_marshal_dump (VALUE obj, VALUE port)
 
VALUE rb_marshal_load (VALUE port)
 

Variables

static ID s_dump
 
static ID s_load
 
static ID s_mdump
 
static ID s_mload
 
static ID s_dump_data
 
static ID s_load_data
 
static ID s_alloc
 
static ID s_call
 
static ID s_getbyte
 
static ID s_read
 
static ID s_write
 
static ID s_binmode
 
static st_tablecompat_allocator_tbl
 
static VALUE compat_allocator_tbl_wrapper
 
static const rb_data_type_t dump_arg_data
 
static const rb_data_type_t load_arg_data
 

Macro Definition Documentation

#define BITSPERSHORT   (2*CHAR_BIT)

Definition at line 27 of file marshal.c.

#define FLOAT_DIG   17

Definition at line 354 of file marshal.c.

Referenced by w_float().

#define has_ivars (   obj,
  ivtbl 
)
Value:
((((ivtbl) = rb_generic_ivar_table(obj)) != 0) || \
#define ENCODING_IS_ASCII8BIT(obj)
static VALUE VALUE obj
Definition: tcltklib.c:3150
struct st_table * rb_generic_ivar_table(VALUE)
Definition: variable.c:907
#define SPECIAL_CONST_P(x)

Referenced by w_object().

#define load_mantissa (   d,
  buf,
  len 
)    (d)

Definition at line 348 of file marshal.c.

Referenced by r_object0().

#define MARSHAL_INFECTION   FL_TAINT

Definition at line 135 of file marshal.c.

#define MARSHAL_MAJOR   4

Definition at line 50 of file marshal.c.

Referenced by Init_marshal(), marshal_dump(), and marshal_load().

#define MARSHAL_MINOR   8

Definition at line 51 of file marshal.c.

Referenced by Init_marshal(), marshal_dump(), and marshal_load().

#define path2module (   path)    must_be_module(rb_path_to_class(path), path)

Definition at line 1433 of file marshal.c.

Referenced by r_object0().

#define prohibit_ivar (   type,
  str 
)
Value:
do { \
if (!ivp || !*ivp) break; \
"can't override instance variable of "type" `%"PRIsVALUE"'", \
(str)); \
} while (0)
VALUE rb_eTypeError
Definition: error.c:548
void rb_raise(VALUE exc, const char *fmt,...)
Definition: error.c:1857
if(args--[1]==0)
Definition: array.c:3187
while(a->frac[0]/shift==0)
Definition: bigdecimal.c:5241
static VALUE char * str
Definition: tcltklib.c:3539
int type
Definition: tcltklib.c:112
int t
Definition: ripper.c:14879
#define PRIsVALUE

Definition at line 1480 of file marshal.c.

Referenced by r_object0().

#define r_bytes (   arg)    r_bytes0(r_long(arg), (arg))

Definition at line 1214 of file marshal.c.

Referenced by r_object0(), r_string(), and r_symreal().

#define r_entry (   v,
  arg 
)    r_entry0((v), (arg)->data->num_entries, (arg))

Definition at line 1034 of file marshal.c.

Referenced by r_object0().

#define rb_intern (   str)    rb_intern_const(str)
#define SHORTDN (   x)    RSHIFT((x),BITSPERSHORT)

Definition at line 29 of file marshal.c.

Referenced by w_object().

#define SHORTLEN (   x)    (x)

Definition at line 32 of file marshal.c.

Referenced by w_object().

#define SHORTMASK   ((1<<BITSPERSHORT)-1)

Definition at line 28 of file marshal.c.

Referenced by w_object().

#define SIGN_EXTEND_CHAR (   c)    ((((unsigned char)(c)) ^ 128) - 128)

Definition at line 1116 of file marshal.c.

Referenced by r_long().

#define SINGLETON_DUMP_UNABLE_P (   klass)
Value:
(RCLASS_M_TBL(klass)->num_entries || \
(RCLASS_IV_TBL(klass) && RCLASS_IV_TBL(klass)->num_entries > 1))
#define RCLASS_IV_TBL(c)
klass
Definition: tcltklib.c:3496
#define RCLASS_M_TBL(c)

Definition at line 463 of file marshal.c.

Referenced by w_extended().

#define TYPE_ARRAY   '['

Definition at line 68 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_BIGNUM   'l'

Definition at line 65 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_CLASS   'c'

Definition at line 73 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_DATA   'd'

Definition at line 61 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_EXTENDED   'e'

Definition at line 58 of file marshal.c.

Referenced by r_object0(), and w_extended().

#define TYPE_FALSE   'F'

Definition at line 55 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_FIXNUM   'i'

Definition at line 56 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_FLOAT   'f'

Definition at line 64 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_HASH   '{'

Definition at line 69 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_HASH_DEF   '}'

Definition at line 70 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_IVAR   'I'

Definition at line 79 of file marshal.c.

Referenced by r_object0(), r_symbol(), w_object(), and w_symbol().

#define TYPE_LINK   '@'

Definition at line 80 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_MODULE   'm'

Definition at line 74 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_MODULE_OLD   'M'

Definition at line 72 of file marshal.c.

Referenced by r_object0().

#define TYPE_NIL   '0'

Definition at line 53 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_OBJECT   'o'

Definition at line 60 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_REGEXP   '/'

Definition at line 67 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_STRING   '"'

Definition at line 66 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_STRUCT   'S'

Definition at line 71 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_SYMBOL   ':'

Definition at line 76 of file marshal.c.

Referenced by r_object0(), r_symbol(), and w_symbol().

#define TYPE_SYMLINK   ';'

Definition at line 77 of file marshal.c.

Referenced by r_object0(), r_symbol(), and w_symbol().

#define TYPE_TRUE   'T'

Definition at line 54 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_UCLASS   'C'

Definition at line 59 of file marshal.c.

Referenced by r_object0(), and w_uclass().

#define TYPE_USERDEF   'u'

Definition at line 62 of file marshal.c.

Referenced by r_object0(), and w_object().

#define TYPE_USRMARSHAL   'U'

Definition at line 63 of file marshal.c.

Referenced by r_object0(), and w_object().

#define w_cstr (   s,
  arg 
)    w_bytes((s), strlen(s), (arg))

Definition at line 251 of file marshal.c.

Referenced by w_float().

Typedef Documentation

typedef char ruby_check_marshal_viral_flags[MARSHAL_INFECTION==(int) MARSHAL_INFECTION?1:-1]

Definition at line 136 of file marshal.c.

Function Documentation

static VALUE append_extmod ( VALUE  obj,
VALUE  extmod 
)
static

Definition at line 1470 of file marshal.c.

References i, obj, RARRAY_AREF, RARRAY_LEN, and rb_extend_object().

Referenced by r_object0().

static void check_dump_arg ( struct dump_arg arg,
ID  sym 
)
static

Definition at line 154 of file marshal.c.

References rb_eRuntimeError, rb_id2name(), rb_raise(), and dump_arg::symbols.

Referenced by marshal_dump(), and w_object().

static void check_load_arg ( struct load_arg arg,
ID  sym 
)
static
static VALUE class2path ( VALUE  klass)
static
static void clear_dump_arg ( struct dump_arg arg)
static
static void clear_load_arg ( struct load_arg arg)
static
static st_table * compat_allocator_table ( void  )
static
static int copy_ivar_i ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

Definition at line 1383 of file marshal.c.

References obj, rb_ivar_defined(), rb_ivar_set(), ST_CONTINUE, val, and value.

Referenced by r_copy_ivar().

static void free_dump_arg ( void ptr)
static

Definition at line 176 of file marshal.c.

References clear_dump_arg(), and xfree.

static void free_load_arg ( void ptr)
static

Definition at line 1016 of file marshal.c.

References clear_load_arg(), and xfree.

static int hash_each ( VALUE  key,
VALUE  value,
struct dump_call_arg arg 
)
static

Definition at line 456 of file marshal.c.

References dump_call_arg::arg, dump_call_arg::limit, ST_CONTINUE, and w_object().

Referenced by w_object().

static int id2encidx ( ID  id,
VALUE  val 
)
static
void Init_marshal ( void  )
static void io_needed ( void  )
inlinestatic

Definition at line 887 of file marshal.c.

References rb_eTypeError, and rb_raise().

Referenced by marshal_dump(), and marshal_load().

static void long_toobig ( int  size)
static

Definition at line 1105 of file marshal.c.

References rb_eTypeError, rb_raise(), and STRINGIZE.

Referenced by r_long().

static void mark_dump_arg ( void ptr)
static
static void mark_load_arg ( void ptr)
static
static int mark_marshal_compat_i ( st_data_t  key,
st_data_t  value 
)
static
static void mark_marshal_compat_t ( void tbl)
static

Definition at line 106 of file marshal.c.

References mark_marshal_compat_i(), and st_foreach().

Referenced by compat_allocator_table().

static VALUE marshal_dump ( int  argc,
VALUE argv 
)
static
static VALUE marshal_load ( int  argc,
VALUE argv 
)
static
static size_t memsize_dump_arg ( const void ptr)
static

Definition at line 183 of file marshal.c.

static size_t memsize_load_arg ( const void ptr)
static

Definition at line 1023 of file marshal.c.

static VALUE must_be_module ( VALUE  v,
VALUE  path 
)
static

Definition at line 1436 of file marshal.c.

References PRIsVALUE, rb_eArgError, rb_raise(), RB_TYPE_P, T_MODULE, and v.

Referenced by r_object0().

static const char* must_not_be_anonymous ( const char *  type,
VALUE  path 
)
static

Definition at line 195 of file marshal.c.

References n, rb_enc_asciicompat, rb_enc_get(), rb_eTypeError, rb_raise(), RSTRING_LEN, and RSTRING_PTR.

Referenced by class2path(), and w_unique().

NORETURN ( static inline void   io_neededvoid)
NORETURN ( static void   too_shortvoid)
static VALUE obj_alloc_by_klass ( VALUE  klass,
struct load_arg arg,
VALUE oldclass 
)
static
static VALUE obj_alloc_by_path ( VALUE  path,
struct load_arg arg 
)
static

Definition at line 1464 of file marshal.c.

References obj_alloc_by_klass(), and path2class().

Referenced by r_object0().

static VALUE path2class ( VALUE  path)
static

Definition at line 1423 of file marshal.c.

References PRIsVALUE, rb_eArgError, rb_path_to_class(), rb_raise(), RB_TYPE_P, T_CLASS, and v.

Referenced by obj_alloc_by_path(), and r_object0().

static int r_byte ( struct load_arg arg)
static
static unsigned char r_byte1_buffered ( struct load_arg arg)
static
static VALUE r_bytes0 ( long  len,
struct load_arg arg 
)
static
static VALUE r_bytes1 ( long  len,
struct load_arg arg 
)
static
static VALUE r_bytes1_buffered ( long  len,
struct load_arg arg 
)
static
static VALUE r_copy_ivar ( VALUE  v,
VALUE  data 
)
static

Definition at line 1394 of file marshal.c.

References copy_ivar_i(), rb_ivar_foreach(), st_data_t, and v.

Referenced by r_object0().

static VALUE r_entry0 ( VALUE  v,
st_index_t  num,
struct load_arg arg 
)
static
static VALUE r_fixup_compat ( VALUE  v,
struct load_arg arg 
)
static
static void r_ivar ( VALUE  obj,
int has_encoding,
struct load_arg arg 
)
static

Definition at line 1401 of file marshal.c.

References id2encidx(), idx, len, r_long(), r_object(), r_symbol(), rb_enc_associate_index(), rb_ivar_set(), TRUE, and val.

Referenced by r_object0().

static VALUE r_leave ( VALUE  v,
struct load_arg arg 
)
static

Definition at line 1375 of file marshal.c.

References r_fixup_compat(), r_post_proc(), and v.

Referenced by r_object0().

static long r_long ( struct load_arg arg)
static

Definition at line 1120 of file marshal.c.

References c, i, long_toobig(), r_byte(), and SIGN_EXTEND_CHAR.

Referenced by r_ivar(), r_object0(), r_symlink(), and r_symreal().

static VALUE r_object ( struct load_arg arg)
static

Definition at line 1906 of file marshal.c.

References Qnil, and r_object0().

Referenced by marshal_load(), r_ivar(), r_object0(), and r_symreal().

static VALUE r_object0 ( struct load_arg arg,
int ivp,
VALUE  extmod 
)
static

Definition at line 1488 of file marshal.c.

References append_extmod(), c, check_load_arg(), CLASS_OF, d, load_arg::data, data, DBL2NUM, dst, e, FALSE, FL_SINGLETON, FL_TEST, i, id, ID2SYM, idx, INFINITY, INTEGER_PACK_LITTLE_ENDIAN, INTEGER_PACK_NEGATIVE, key, klass, len, link(), load_mantissa, marshal_compat_t::loader, LONG2FIX, must_be_module(), NAN, NIL_P(), NULL, obj_alloc_by_klass(), obj_alloc_by_path(), path, path2class(), path2module, PRIsVALUE, prohibit_ivar, ptr, Qfalse, Qnil, Qtrue, Qundef, r, r_byte(), r_bytes, r_bytes0(), r_copy_ivar(), r_entry, r_entry0(), r_fixup_compat(), r_ivar(), r_leave(), r_long(), r_object(), r_post_proc(), r_prepare(), r_string(), r_symbol(), r_symlink(), r_symreal(), r_unique(), RARRAY_AREF, RARRAY_LEN, rb_ary_clear(), rb_ary_new2, rb_ary_pop(), rb_ary_push(), rb_ary_tmp_new(), rb_class2name(), rb_class_inherited_p(), rb_class_name(), rb_eArgError, rb_eTypeError, rb_extend_object(), rb_funcall2(), rb_get_alloc_func(), rb_hash_aset(), rb_hash_new(), rb_id2name(), rb_integer_unpack(), rb_obj_alloc(), rb_obj_respond_to(), rb_path_to_class(), rb_prepend_module(), rb_raise(), rb_reg_new_str(), rb_singleton_class(), rb_special_const_p(), rb_str_resize(), rb_str_set_len(), rb_struct_initialize(), rb_struct_s_members(), RB_TYPE_P, RBASIC, RBASIC_SET_CLASS, load_arg::readable, RHASH_SET_IFNONE, RSTRING_LEN, RSTRING_PTR, RTEST, s_load, s_load_data, s_mload, src, st_data_t, st_lookup(), str, strtod, SYM2ID, T_CLASS, T_DATA, T_MODULE, T_OBJECT, T_STRUCT, tmp, TRUE, type, TYPE, TYPE_ARRAY, TYPE_BIGNUM, TYPE_CLASS, TYPE_DATA, TYPE_EXTENDED, TYPE_FALSE, TYPE_FIXNUM, TYPE_FLOAT, TYPE_HASH, TYPE_HASH_DEF, TYPE_IVAR, TYPE_LINK, TYPE_MODULE, TYPE_MODULE_OLD, TYPE_NIL, TYPE_OBJECT, TYPE_REGEXP, TYPE_STRING, TYPE_STRUCT, TYPE_SYMBOL, TYPE_SYMLINK, TYPE_TRUE, TYPE_UCLASS, TYPE_USERDEF, TYPE_USRMARSHAL, v, value, and values.

Referenced by r_object().

static VALUE r_post_proc ( VALUE  v,
struct load_arg arg 
)
static

Definition at line 1365 of file marshal.c.

References check_load_arg(), load_arg::proc, rb_funcall(), s_call, and v.

Referenced by r_leave(), and r_object0().

static st_index_t r_prepare ( struct load_arg arg)
static

Definition at line 1048 of file marshal.c.

References load_arg::data, idx, st_table::num_entries, Qundef, st_data_t, and st_insert().

Referenced by r_object0().

static VALUE r_string ( struct load_arg arg)
static

Definition at line 1322 of file marshal.c.

References r_bytes.

Referenced by r_object0().

static ID r_symbol ( struct load_arg arg)
static
static ID r_symlink ( struct load_arg arg)
static

Definition at line 1258 of file marshal.c.

References id, r_long(), rb_eArgError, rb_raise(), st_data_t, st_lookup(), and load_arg::symbols.

Referenced by r_object0(), and r_symbol().

static ID r_symreal ( struct load_arg arg,
int  ivar 
)
static
static VALUE r_unique ( struct load_arg arg)
static

Definition at line 1316 of file marshal.c.

References r_symbol(), and rb_id2str().

Referenced by r_object0().

void rb_marshal_define_compat ( VALUE  newclass,
VALUE  oldclass,
VALUE(*)(VALUE dumper,
VALUE(*)(VALUE, VALUE loader 
)
VALUE rb_marshal_dump ( VALUE  obj,
VALUE  port 
)

Definition at line 2157 of file marshal.c.

References argc, argv, marshal_dump(), NIL_P(), and obj.

VALUE rb_marshal_load ( VALUE  port)

Definition at line 2169 of file marshal.c.

References marshal_load().

Referenced by date_s__load().

static void too_short ( void  )
static

Definition at line 1042 of file marshal.c.

References rb_eArgError, and rb_raise().

Referenced by r_byte(), r_byte1_buffered(), r_bytes0(), r_bytes1(), and r_bytes1_buffered().

static void w_byte ( char  c,
struct dump_arg arg 
)
static

Definition at line 239 of file marshal.c.

References w_nbyte().

Referenced by marshal_dump(), w_class(), w_extended(), w_long(), w_object(), w_short(), w_symbol(), and w_uclass().

static void w_bytes ( const char *  s,
long  n,
struct dump_arg arg 
)
static

Definition at line 245 of file marshal.c.

References w_long(), and w_nbyte().

Referenced by w_float(), w_object(), and w_symbol().

static void w_class ( char  type,
VALUE  obj,
struct dump_arg arg,
int  check 
)
static
static void w_encoding ( VALUE  obj,
long  num,
struct dump_call_arg arg 
)
static
static void w_extended ( VALUE  klass,
struct dump_arg arg,
int  check 
)
static
static void w_float ( double  d,
struct dump_arg arg 
)
static

Definition at line 358 of file marshal.c.

References e, FLOAT_DIG, int, isinf(), isnan, memcpy(), memset(), mode, p, ruby_dtoa(), snprintf, w_bytes(), w_cstr, and xfree.

Referenced by w_object().

static void w_ivar ( VALUE  obj,
st_table tbl,
struct dump_call_arg arg 
)
static

Definition at line 568 of file marshal.c.

References st_table::num_entries, st_data_t, st_foreach_safe(), w_encoding(), and w_obj_each().

Referenced by w_object().

static void w_long ( long  x,
struct dump_arg arg 
)
static

Definition at line 261 of file marshal.c.

References buf, i, int, len, rb_eTypeError, rb_raise(), and w_byte().

Referenced by w_bytes(), w_encoding(), w_object(), and w_symbol().

static void w_nbyte ( const char *  s,
long  n,
struct dump_arg arg 
)
static
static int w_obj_each ( st_data_t  key,
st_data_t  val,
st_data_t  a 
)
static
static void w_object ( VALUE  obj,
struct dump_arg arg,
int  limit 
)
static

Definition at line 598 of file marshal.c.

References dump_call_arg::arg, arg, BDIGIT, BUILTIN_TYPE, check_dump_arg(), class2path(), dump_arg::compat_tbl, d, dump_arg::data, marshal_compat_t::dumper, FALSE, FIX2INT, FIX2LONG, FIXNUM_P, FL_SINGLETON, FL_TEST, FLONUM_P, has_ivars, hash_each(), HASH_PROC_DEFAULT, i, dump_arg::infection, int, INT2NUM, klass, len, dump_call_arg::limit, NIL_P(), st_table::num_entries, obj, opts, path, Qfalse, Qnil, Qtrue, RARRAY_AREF, RARRAY_LEN, rb_builtin_type_name(), rb_cArray, rb_cHash, rb_cRegexp, rb_cString, rb_eArgError, rb_eRuntimeError, rb_eTypeError, rb_funcall2(), RB_GC_GUARD(), rb_get_alloc_func(), rb_hash_foreach(), rb_int2big(), rb_obj_classname(), rb_obj_respond_to(), rb_raise(), rb_reg_options(), rb_struct_members(), RB_TYPE_P, RBASIC, RBASIC_CLASS, RBIGNUM_DIGITS, RBIGNUM_LEN, RBIGNUM_SIGN, RFLOAT_VALUE, RHASH_IFNONE, RHASH_SIZE, RREGEXP_SRC_LEN, RREGEXP_SRC_PTR, RSTRING_LEN, RSTRING_PTR, RSTRUCT_GET, RSTRUCT_LEN, s_dump, s_dump_data, s_mdump, SHORTDN, SHORTLEN, SHORTMASK, SIZEOF_BDIGITS, st_add_direct(), st_data_t, st_insert(), st_lookup(), SYM2ID, SYMBOL_P, T_ARRAY, T_BIGNUM, T_CLASS, T_DATA, T_FLOAT, T_HASH, T_MODULE, T_OBJECT, T_REGEXP, T_STRING, T_STRUCT, TRUE, TYPE_ARRAY, TYPE_BIGNUM, TYPE_CLASS, TYPE_DATA, TYPE_FALSE, TYPE_FIXNUM, TYPE_FLOAT, TYPE_HASH, TYPE_HASH_DEF, TYPE_IVAR, TYPE_LINK, TYPE_MODULE, TYPE_NIL, TYPE_OBJECT, TYPE_REGEXP, TYPE_STRING, TYPE_STRUCT, TYPE_TRUE, TYPE_USERDEF, TYPE_USRMARSHAL, v, w_byte(), w_bytes(), w_class(), w_float(), w_ivar(), w_long(), w_objivar(), w_short(), w_symbol(), and w_uclass().

Referenced by hash_each(), marshal_dump(), w_encoding(), and w_obj_each().

static void w_objivar ( VALUE  obj,
struct dump_call_arg arg 
)
static

Definition at line 579 of file marshal.c.

References i, len, ptr, Qundef, rb_ivar_foreach(), ROBJECT_IVPTR, ROBJECT_NUMIV, st_data_t, w_encoding(), and w_obj_each().

Referenced by w_object().

static void w_short ( int  x,
struct dump_arg arg 
)
static

Definition at line 254 of file marshal.c.

References w_byte().

Referenced by w_object().

static void w_symbol ( ID  id,
struct dump_arg arg 
)
static
static void w_uclass ( VALUE  obj,
VALUE  super,
struct dump_arg arg 
)
static

Definition at line 504 of file marshal.c.

References class2path(), CLASS_OF, klass, rb_class_real(), TRUE, TYPE_UCLASS, w_byte(), w_extended(), and w_unique().

Referenced by w_object().

static void w_unique ( VALUE  s,
struct dump_arg arg 
)
static

Definition at line 447 of file marshal.c.

References must_not_be_anonymous(), rb_intern_str, and w_symbol().

Referenced by w_class(), w_extended(), and w_uclass().

Variable Documentation

st_table* compat_allocator_tbl
static

Definition at line 93 of file marshal.c.

Referenced by compat_allocator_table().

VALUE compat_allocator_tbl_wrapper
static

Definition at line 94 of file marshal.c.

Referenced by compat_allocator_table().

const rb_data_type_t dump_arg_data
static
Initial value:
= {
"dump_arg",
}
static size_t memsize_dump_arg(const void *ptr)
Definition: marshal.c:183
static void mark_dump_arg(void *ptr)
Definition: marshal.c:165
#define RUBY_TYPED_FREE_IMMEDIATELY
static void free_dump_arg(void *ptr)
Definition: marshal.c:176
#define NULL
Definition: _sdbm.c:102

Definition at line 188 of file marshal.c.

Referenced by marshal_dump().

const rb_data_type_t load_arg_data
static
Initial value:
= {
"load_arg",
}
static size_t memsize_load_arg(const void *ptr)
Definition: marshal.c:1023
#define RUBY_TYPED_FREE_IMMEDIATELY
static void free_load_arg(void *ptr)
Definition: marshal.c:1016
static void mark_load_arg(void *ptr)
Definition: marshal.c:1006
#define NULL
Definition: _sdbm.c:102

Definition at line 1028 of file marshal.c.

Referenced by marshal_load().

ID s_alloc
static

Definition at line 83 of file marshal.c.

Referenced by Init_marshal().

ID s_binmode
static

Definition at line 84 of file marshal.c.

Referenced by Init_marshal(), marshal_dump(), and marshal_load().

ID s_call
static

Definition at line 83 of file marshal.c.

Referenced by Init_marshal(), and r_post_proc().

ID s_dump
static

Definition at line 82 of file marshal.c.

Referenced by Init_marshal(), and w_object().

ID s_dump_data
static

Definition at line 83 of file marshal.c.

Referenced by Init_marshal(), and w_object().

ID s_getbyte
static

Definition at line 84 of file marshal.c.

Referenced by Init_marshal(), marshal_load(), and r_byte().

ID s_load
static

Definition at line 82 of file marshal.c.

Referenced by Init_marshal(), and r_object0().

ID s_load_data
static

Definition at line 83 of file marshal.c.

Referenced by Init_marshal(), and r_object0().

ID s_mdump
static

Definition at line 82 of file marshal.c.

Referenced by Init_marshal(), and w_object().

ID s_mload
static

Definition at line 82 of file marshal.c.

Referenced by Init_marshal(), and r_object0().

ID s_read
static

Definition at line 84 of file marshal.c.

Referenced by Init_marshal(), marshal_load(), r_byte1_buffered(), r_bytes1(), and r_bytes1_buffered().

ID s_write
static

Definition at line 84 of file marshal.c.

Referenced by Init_marshal(), and marshal_dump().