Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
fcccd358
Commit
fcccd358
authored
5 years ago
by
Alexei Fedorov
Committed by
TrustedFirmware Code Review
5 years ago
Browse files
Options
Download
Plain Diff
Merge "libc: add memrchr" into integration
parents
2bcaeab6
ebff1072
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/lib/libc/string.h
+1
-0
include/lib/libc/string.h
lib/libc/libc.mk
+1
-0
lib/libc/libc.mk
lib/libc/memrchr.c
+24
-0
lib/libc/memrchr.c
with
26 additions
and
0 deletions
+26
-0
include/lib/libc/string.h
View file @
fcccd358
...
...
@@ -19,6 +19,7 @@ int memcmp(const void *s1, const void *s2, size_t len);
int
strcmp
(
const
char
*
s1
,
const
char
*
s2
);
int
strncmp
(
const
char
*
s1
,
const
char
*
s2
,
size_t
n
);
void
*
memchr
(
const
void
*
src
,
int
c
,
size_t
len
);
void
*
memrchr
(
const
void
*
src
,
int
c
,
size_t
len
);
char
*
strchr
(
const
char
*
s
,
int
c
);
void
*
memset
(
void
*
dst
,
int
val
,
size_t
count
);
size_t
strlen
(
const
char
*
s
);
...
...
This diff is collapsed.
Click to expand it.
lib/libc/libc.mk
View file @
fcccd358
...
...
@@ -12,6 +12,7 @@ LIBC_SRCS := $(addprefix lib/libc/, \
memcmp.c
\
memcpy.c
\
memmove.c
\
memrchr.c
\
memset.c
\
printf.c
\
putchar.c
\
...
...
This diff is collapsed.
Click to expand it.
lib/libc/memrchr.c
0 → 100644
View file @
fcccd358
/*
* Copyright (c) 2019, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <string.h>
#undef memrchr
void
*
memrchr
(
const
void
*
src
,
int
c
,
size_t
len
)
{
const
unsigned
char
*
s
=
src
+
(
len
-
1
);
while
(
len
--
)
{
if
(
*
s
==
(
unsigned
char
)
c
)
{
return
(
void
*
)
s
;
}
s
--
;
}
return
NULL
;
}
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help