File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 005a3efb8bc8b21d19ddb72811ec95917ca74e27
2
+ refs/heads/master: 6408d54c133554a938ffc304f320786cfe6a424e
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
5
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
Original file line number Diff line number Diff line change 17
17
from_char,
18
18
from_chars,
19
19
from_cstr,
20
+ from_cstr_len,
20
21
concat,
21
22
connect,
22
23
@@ -210,6 +211,24 @@ unsafe fn from_cstr(cstr: sbuf) -> str {
210
211
ret from_bytes( res) ;
211
212
}
212
213
214
+ /*
215
+ Function: from_cstr_len
216
+
217
+ Create a Rust string from a C string of the given length
218
+ */
219
+ unsafe fn from_cstr_len ( cstr : sbuf , len : uint ) -> str {
220
+ let res = [ ] ;
221
+ let start = cstr;
222
+ let curr = start;
223
+ let i = 0 u;
224
+ while i < len {
225
+ vec:: push ( res, * curr) ;
226
+ i += 1 u;
227
+ curr = ptr:: offset ( start, i) ;
228
+ }
229
+ ret from_bytes( res) ;
230
+ }
231
+
213
232
/*
214
233
Function: concat
215
234
You can’t perform that action at this time.
0 commit comments