Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relibc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Limkilde Svendsen
relibc
Commits
774856f9
Unverified
Commit
774856f9
authored
7 years ago
by
Tom Almeida
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update lib.rs
parent
3470882d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/string/src/lib.rs
+6
-9
6 additions, 9 deletions
src/string/src/lib.rs
with
6 additions
and
9 deletions
src/string/src/lib.rs
+
6
−
9
View file @
774856f9
...
@@ -12,6 +12,7 @@ use platform::types::*;
...
@@ -12,6 +12,7 @@ use platform::types::*;
use
errno
::
*
;
use
errno
::
*
;
use
core
::
cmp
;
use
core
::
cmp
;
use
core
::
usize
;
use
core
::
usize
;
use
core
::
ptr
;
#[no_mangle]
#[no_mangle]
pub
unsafe
extern
"C"
fn
memccpy
(
pub
unsafe
extern
"C"
fn
memccpy
(
...
@@ -21,18 +22,17 @@ pub unsafe extern "C" fn memccpy(
...
@@ -21,18 +22,17 @@ pub unsafe extern "C" fn memccpy(
n
:
usize
,
n
:
usize
,
)
->
*
mut
c_void
{
)
->
*
mut
c_void
{
use
compiler_builtins
::
mem
::
memcpy
;
use
compiler_builtins
::
mem
::
memcpy
;
use
core
::
mem
;
let
dest
=
dest
as
*
mut
u8
;
let
dest
=
dest
as
*
mut
u8
;
let
to
=
memchr
(
src
,
c
,
n
);
let
to
=
memchr
(
src
,
c
,
n
);
if
to
as
usize
==
0
{
if
to
.is_null
()
{
return
to
;
return
to
;
}
}
let
src
=
src
as
*
mut
u8
;
let
src
=
src
as
*
mut
u8
;
let
dist
=
(
(
to
as
usize
)
-
(
src
as
usize
)
)
/
mem
::
size_of
::
<
u8
>
()
;
let
dist
=
(
to
as
usize
)
-
(
src
as
usize
);
if
memcpy
(
dest
,
src
,
dist
)
as
usize
>
0
{
if
memcpy
(
dest
,
src
,
dist
)
as
usize
>
0
{
return
dest
.offset
(
dist
as
isize
+
1
)
as
*
mut
c_void
;
return
dest
.offset
(
dist
as
isize
+
1
)
as
*
mut
c_void
;
}
}
0usize
as
*
mut
c_void
ptr
::
null_mut
()
}
}
#[no_mangle]
#[no_mangle]
...
@@ -40,15 +40,12 @@ pub unsafe extern "C" fn memchr(s: *const c_void, c: c_int, n: usize) -> *mut c_
...
@@ -40,15 +40,12 @@ pub unsafe extern "C" fn memchr(s: *const c_void, c: c_int, n: usize) -> *mut c_
let
s
=
s
as
*
mut
u8
;
let
s
=
s
as
*
mut
u8
;
let
c
=
c
as
u8
;
let
c
=
c
as
u8
;
let
mut
i
=
0
;
let
mut
i
=
0
;
loop
{
for
i
in
0
..
n
{
if
*
s
.offset
(
i
as
isize
)
==
c
{
if
*
s
.offset
(
i
as
isize
)
==
c
{
return
s
.offset
(
i
as
isize
)
as
*
mut
c_void
;
return
s
.offset
(
i
as
isize
)
as
*
mut
c_void
;
}
}
i
+=
1
;
if
i
==
n
{
return
0usize
as
*
mut
c_void
;
}
}
}
ptr
::
null_mut
()
}
}
// #[no_mangle]
// #[no_mangle]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment