File tree Expand file tree Collapse file tree 3 files changed +20
-18
lines changed Expand file tree Collapse file tree 3 files changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -154,11 +154,29 @@ pub fn rs_make_string(pool: &mut StringPool) -> StrNumber {
154154 ( pool. str_ptr - 1 ) as StrNumber
155155}
156156
157+ pub fn rs_slow_make_string ( pool : & mut StringPool ) -> StrNumber {
158+ let t = rs_make_string ( pool) ;
159+ let s = rs_search_string ( pool, t) ;
160+
161+ if s > 0 {
162+ pool. str_ptr -= 1 ;
163+ pool. pool_ptr = pool. str_start [ pool. str_ptr - TOO_BIG_CHAR ] as usize ;
164+ s
165+ } else {
166+ t
167+ }
168+ }
169+
157170#[ no_mangle]
158171pub extern "C" fn make_string ( ) -> StrNumber {
159172 STRING_POOL . with_borrow_mut ( rs_make_string)
160173}
161174
175+ #[ no_mangle]
176+ pub extern "C" fn slow_make_string ( ) -> StrNumber {
177+ STRING_POOL . with_borrow_mut ( |pool| rs_slow_make_string ( pool) )
178+ }
179+
162180pub fn rs_str_length ( pool : & StringPool , s : StrNumber ) -> usize {
163181 if s >= 0x10000 {
164182 pool. str ( s - 0x10000 ) . len ( )
Original file line number Diff line number Diff line change @@ -88,21 +88,3 @@ str_eq_buf(str_number s, int32_t k)
8888
8989 return true;
9090}
91-
92- str_number
93- slow_make_string (void )
94- {
95- str_number s ;
96- str_number t ;
97-
98- t = make_string ();
99- s = search_string (t );
100-
101- if (s > 0 ) {
102- set_str_ptr (str_ptr ()- 1 );
103- set_pool_ptr (str_start (str_ptr () - TOO_BIG_CHAR ));
104- return s ;
105- }
106-
107- return t ;
108- }
Original file line number Diff line number Diff line change @@ -449,6 +449,8 @@ void set_max_strings(uintptr_t val);
449449
450450StrNumber make_string (void );
451451
452+ StrNumber slow_make_string (void );
453+
452454uintptr_t length (StrNumber s );
453455
454456bool str_eq_str (StrNumber s1 , StrNumber s2 );
You can’t perform that action at this time.
0 commit comments