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
fb386011
Commit
fb386011
authored
Nov 20, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename API mrb_str_dup_static() -> mrb_str_pool()
parent
217595c3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
25 deletions
+25
-25
include/mruby/string.h
include/mruby/string.h
+1
-1
src/codegen.c
src/codegen.c
+1
-1
src/load.c
src/load.c
+1
-1
src/state.c
src/state.c
+22
-0
src/string.c
src/string.c
+0
-22
No files found.
include/mruby/string.h
View file @
fb386011
...
@@ -50,7 +50,6 @@ char *mrb_string_value_cstr(mrb_state *mrb, mrb_value *ptr);
...
@@ -50,7 +50,6 @@ char *mrb_string_value_cstr(mrb_state *mrb, mrb_value *ptr);
char
*
mrb_string_value_ptr
(
mrb_state
*
mrb
,
mrb_value
ptr
);
char
*
mrb_string_value_ptr
(
mrb_state
*
mrb
,
mrb_value
ptr
);
int
mrb_str_offset
(
mrb_state
*
mrb
,
mrb_value
str
,
int
pos
);
int
mrb_str_offset
(
mrb_state
*
mrb
,
mrb_value
str
,
int
pos
);
mrb_value
mrb_str_dup
(
mrb_state
*
mrb
,
mrb_value
str
);
mrb_value
mrb_str_dup
(
mrb_state
*
mrb
,
mrb_value
str
);
mrb_value
mrb_str_dup_static
(
mrb_state
*
mrb
,
mrb_value
str
);
mrb_value
mrb_str_intern
(
mrb_state
*
mrb
,
mrb_value
self
);
mrb_value
mrb_str_intern
(
mrb_state
*
mrb
,
mrb_value
self
);
mrb_value
mrb_str_cat_cstr
(
mrb_state
*
,
mrb_value
,
const
char
*
);
mrb_value
mrb_str_cat_cstr
(
mrb_state
*
,
mrb_value
,
const
char
*
);
mrb_value
mrb_str_to_inum
(
mrb_state
*
mrb
,
mrb_value
str
,
int
base
,
int
badcheck
);
mrb_value
mrb_str_to_inum
(
mrb_state
*
mrb
,
mrb_value
str
,
int
base
,
int
badcheck
);
...
@@ -66,6 +65,7 @@ mrb_value mrb_str_append(mrb_state *mrb, mrb_value str, mrb_value str2);
...
@@ -66,6 +65,7 @@ mrb_value mrb_str_append(mrb_state *mrb, mrb_value str, mrb_value str2);
int
mrb_str_cmp
(
mrb_state
*
mrb
,
mrb_value
str1
,
mrb_value
str2
);
int
mrb_str_cmp
(
mrb_state
*
mrb
,
mrb_value
str1
,
mrb_value
str2
);
char
*
mrb_str_to_cstr
(
mrb_state
*
mrb
,
mrb_value
str
);
char
*
mrb_str_to_cstr
(
mrb_state
*
mrb
,
mrb_value
str
);
mrb_value
mrb_str_pool
(
mrb_state
*
mrb
,
mrb_value
str
);
/* For backward compatibility */
/* For backward compatibility */
static
inline
mrb_value
static
inline
mrb_value
...
...
src/codegen.c
View file @
fb386011
...
@@ -440,7 +440,7 @@ new_lit(codegen_scope *s, mrb_value val)
...
@@ -440,7 +440,7 @@ new_lit(codegen_scope *s, mrb_value val)
switch
(
mrb_type
(
val
))
{
switch
(
mrb_type
(
val
))
{
case
MRB_TT_STRING
:
case
MRB_TT_STRING
:
*
pv
=
mrb_str_
dup_static
(
s
->
mrb
,
val
);
*
pv
=
mrb_str_
pool
(
s
->
mrb
,
val
);
break
;
break
;
case
MRB_TT_FLOAT
:
case
MRB_TT_FLOAT
:
...
...
src/load.c
View file @
fb386011
...
@@ -110,7 +110,7 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, uint32_t *len)
...
@@ -110,7 +110,7 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, uint32_t *len)
break
;
break
;
case
IREP_TT_STRING
:
case
IREP_TT_STRING
:
irep
->
pool
[
i
]
=
mrb_str_
dup_static
(
mrb
,
s
);
irep
->
pool
[
i
]
=
mrb_str_
pool
(
mrb
,
s
);
break
;
break
;
default:
default:
...
...
src/state.c
View file @
fb386011
...
@@ -147,6 +147,28 @@ mrb_irep_free(mrb_state *mrb, mrb_irep *irep)
...
@@ -147,6 +147,28 @@ mrb_irep_free(mrb_state *mrb, mrb_irep *irep)
mrb_free
(
mrb
,
irep
);
mrb_free
(
mrb
,
irep
);
}
}
mrb_value
mrb_str_pool
(
mrb_state
*
mrb
,
mrb_value
str
)
{
struct
RString
*
s
=
mrb_str_ptr
(
str
);
struct
RString
*
ns
;
mrb_int
len
;
ns
=
(
struct
RString
*
)
mrb_malloc
(
mrb
,
sizeof
(
struct
RString
));
ns
->
tt
=
MRB_TT_STRING
;
ns
->
c
=
mrb
->
string_class
;
len
=
s
->
len
;
ns
->
len
=
len
;
ns
->
ptr
=
(
char
*
)
mrb_malloc
(
mrb
,
(
size_t
)
len
+
1
);
if
(
s
->
ptr
)
{
memcpy
(
ns
->
ptr
,
s
->
ptr
,
len
);
}
ns
->
ptr
[
len
]
=
'\0'
;
return
mrb_obj_value
(
ns
);
}
void
void
mrb_free_context
(
mrb_state
*
mrb
,
struct
mrb_context
*
c
)
mrb_free_context
(
mrb_state
*
mrb
,
struct
mrb_context
*
c
)
{
{
...
...
src/string.c
View file @
fb386011
...
@@ -734,28 +734,6 @@ mrb_str_dup(mrb_state *mrb, mrb_value str)
...
@@ -734,28 +734,6 @@ mrb_str_dup(mrb_state *mrb, mrb_value str)
return
mrb_str_new
(
mrb
,
s
->
ptr
,
s
->
len
);
return
mrb_str_new
(
mrb
,
s
->
ptr
,
s
->
len
);
}
}
mrb_value
mrb_str_dup_static
(
mrb_state
*
mrb
,
mrb_value
str
)
{
struct
RString
*
s
=
mrb_str_ptr
(
str
);
struct
RString
*
ns
;
mrb_int
len
;
ns
=
(
struct
RString
*
)
mrb_malloc
(
mrb
,
sizeof
(
struct
RString
));
ns
->
tt
=
MRB_TT_STRING
;
ns
->
c
=
mrb
->
string_class
;
len
=
s
->
len
;
ns
->
len
=
len
;
ns
->
ptr
=
(
char
*
)
mrb_malloc
(
mrb
,
(
size_t
)
len
+
1
);
if
(
s
->
ptr
)
{
memcpy
(
ns
->
ptr
,
s
->
ptr
,
len
);
}
ns
->
ptr
[
len
]
=
'\0'
;
return
mrb_obj_value
(
ns
);
}
static
mrb_value
static
mrb_value
mrb_str_aref
(
mrb_state
*
mrb
,
mrb_value
str
,
mrb_value
indx
)
mrb_str_aref
(
mrb_state
*
mrb
,
mrb_value
str
,
mrb_value
indx
)
{
{
...
...
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