Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
0b4f3321
Commit
0b4f3321
authored
Jun 05, 2012
by
Yukihiro Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
merge conflict resolution
parents
b2e6a0fc
f06eceaa
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
12 deletions
+16
-12
include/mruby.h
include/mruby.h
+2
-1
src/dump.c
src/dump.c
+4
-2
src/load.c
src/load.c
+1
-1
src/symbol.c
src/symbol.c
+9
-8
No files found.
include/mruby.h
View file @
0b4f3321
...
...
@@ -332,9 +332,10 @@ mrb_value mrb_funcall(mrb_state*, mrb_value, const char*, int,...);
mrb_value
mrb_funcall_argv
(
mrb_state
*
,
mrb_value
,
const
char
*
,
int
,
mrb_value
*
);
mrb_value
mrb_funcall_with_block
(
mrb_state
*
,
mrb_value
,
const
char
*
,
int
,
mrb_value
*
,
mrb_value
);
mrb_sym
mrb_intern
(
mrb_state
*
,
const
char
*
);
mrb_sym
mrb_intern2
(
mrb_state
*
,
const
char
*
,
int
);
mrb_sym
mrb_intern2
(
mrb_state
*
,
const
char
*
,
int
);
mrb_sym
mrb_intern_str
(
mrb_state
*
,
mrb_value
);
const
char
*
mrb_sym2name
(
mrb_state
*
,
mrb_sym
);
const
char
*
mrb_sym2name_len
(
mrb_state
*
,
mrb_sym
,
int
*
);
mrb_value
mrb_str_format
(
mrb_state
*
,
int
,
const
mrb_value
*
,
mrb_value
);
void
*
mrb_malloc
(
mrb_state
*
,
size_t
);
...
...
src/dump.c
View file @
0b4f3321
...
...
@@ -268,8 +268,10 @@ get_syms_block_size(mrb_state *mrb, mrb_irep *irep, int type)
size
+=
DUMP_SIZE
(
MRB_DUMP_SIZE_OF_SHORT
,
type
);
/* snl(n) */
if
(
irep
->
syms
[
sym_no
]
!=
0
)
{
name
=
mrb_sym2name
(
mrb
,
irep
->
syms
[
sym_no
]);
nlen
=
str_dump_len
((
char
*
)
name
,
strlen
(
name
),
type
);
int
len
;
name
=
mrb_sym2name_len
(
mrb
,
irep
->
syms
[
sym_no
],
&
len
);
nlen
=
str_dump_len
((
char
*
)
name
,
len
,
type
);
size
+=
nlen
;
/* sn(n) */
}
}
...
...
src/load.c
View file @
0b4f3321
...
...
@@ -477,7 +477,7 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32
memcpy
(
buf
,
src
,
snl
);
//symbol name
src
+=
snl
;
buf
[
snl
]
=
'\0'
;
irep
->
syms
[
i
]
=
mrb_intern
(
mrb
,
buf
);
irep
->
syms
[
i
]
=
mrb_intern
2
(
mrb
,
buf
,
snl
);
}
}
crc
=
calc_crc_16_ccitt
((
unsigned
char
*
)
pStart
,
src
-
pStart
);
//Calculate CRC
...
...
src/symbol.c
View file @
0b4f3321
...
...
@@ -34,7 +34,7 @@ sym_hash_func(mrb_state *mrb, const symbol_name s)
}
return
h
;
}
#define sym_hash_equal(mrb,a, b) (a.len == b.len &&
strcmp(a.name, b.name
) == 0)
#define sym_hash_equal(mrb,a, b) (a.len == b.len &&
memcmp(a.name, b.name, a.len
) == 0)
KHASH_INIT
(
n2s
,
symbol_name
,
mrb_sym
,
1
,
sym_hash_func
,
sym_hash_equal
)
/* ------------------------------------------------------ */
...
...
@@ -76,8 +76,8 @@ mrb_intern_str(mrb_state *mrb, mrb_value str)
return
mrb_intern2
(
mrb
,
RSTRING_PTR
(
str
),
RSTRING_LEN
(
str
));
}
static
const
char
*
sym2name_len
(
mrb_state
*
mrb
,
mrb_sym
sym
,
int
*
lenp
)
const
char
*
mrb_
sym2name_len
(
mrb_state
*
mrb
,
mrb_sym
sym
,
int
*
lenp
)
{
khash_t
(
n2s
)
*
h
=
mrb
->
name2sym
;
khiter_t
k
;
...
...
@@ -185,7 +185,7 @@ mrb_sym_to_s(mrb_state *mrb, mrb_value sym)
const
char
*
p
;
int
len
;
p
=
sym2name_len
(
mrb
,
id
,
&
len
);
p
=
mrb_
sym2name_len
(
mrb
,
id
,
&
len
);
return
mrb_str_new
(
mrb
,
p
,
len
);
}
...
...
@@ -290,7 +290,9 @@ symname_p(const char *name)
case
'*'
:
if
(
*++
m
==
'*'
)
++
m
;
break
;
case
'!'
:
if
(
*++
m
==
'='
)
++
m
;
break
;
case
'+'
:
case
'-'
:
if
(
*++
m
==
'@'
)
++
m
;
break
;
...
...
@@ -327,7 +329,7 @@ sym_inspect(mrb_state *mrb, mrb_value sym)
int
len
;
mrb_sym
id
=
SYM2ID
(
sym
);
name
=
sym2name_len
(
mrb
,
id
,
&
len
);
name
=
mrb_
sym2name_len
(
mrb
,
id
,
&
len
);
str
=
mrb_str_new
(
mrb
,
0
,
len
+
1
);
RSTRING
(
str
)
->
buf
[
0
]
=
':'
;
memcpy
(
RSTRING
(
str
)
->
buf
+
1
,
name
,
len
);
...
...
@@ -342,7 +344,7 @@ const char*
mrb_sym2name
(
mrb_state
*
mrb
,
mrb_sym
sym
)
{
int
len
;
const
char
*
name
=
sym2name_len
(
mrb
,
sym
,
&
len
);
const
char
*
name
=
mrb_
sym2name_len
(
mrb
,
sym
,
&
len
);
if
(
!
name
)
return
NULL
;
if
(
symname_p
(
name
)
&&
strlen
(
name
)
==
len
)
{
...
...
@@ -354,7 +356,6 @@ mrb_sym2name(mrb_state *mrb, mrb_sym sym)
}
}
void
mrb_init_symbols
(
mrb_state
*
mrb
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment