diff --git a/headers/posix/string.h b/headers/posix/string.h
index 81992c0..1f53761 100644
a
|
b
|
extern "C" {
|
16 | 16 | |
17 | 17 | /* memXXX() functions */ |
18 | 18 | extern void *memchr(const void *source, int value, size_t length); |
| 19 | extern void *memrchr(const void *source, int value, size_t length); |
19 | 20 | extern int memcmp(const void *buffer1, const void *buffer2, size_t length); |
20 | 21 | extern void *memcpy(void *dest, const void *source, size_t length); |
21 | 22 | extern void *memccpy(void *dest, const void *source, int stopByte, size_t length); |
diff --git a/src/system/libroot/posix/string/Jamfile b/src/system/libroot/posix/string/Jamfile
index 8fdbe7b..0cc107f 100644
a
|
b
|
MergeObject posix_string.o :
|
12 | 12 | ffs.cpp |
13 | 13 | memccpy.c |
14 | 14 | memchr.c |
| 15 | memrchr.c |
15 | 16 | memcmp.c |
16 | 17 | memmove.c |
17 | 18 | stpcpy.c |
diff --git a/src/system/libroot/posix/string/memrchr.c b/src/system/libroot/posix/string/memrchr.c
new file mode 100644
index 0000000..98dc1b6
-
|
+
|
|
| 1 | /* |
| 2 | * Copyright 2011, Haiku, Inc. |
| 3 | * Distributed under the terms of the MIT license. |
| 4 | * |
| 5 | * Authors: |
| 6 | * Dario Casalinuovo |
| 7 | */ |
| 8 | |
| 9 | #include <sys/types.h> |
| 10 | #include <string.h> |
| 11 | |
| 12 | void* |
| 13 | memrchr(const void* source, int value, size_t length) |
| 14 | { |
| 15 | unsigned const char* b = source+length-1; |
| 16 | size_t i; |
| 17 | |
| 18 | for (i = 0; i < length; i++) { |
| 19 | if (*b == value) |
| 20 | return (void*)(b); |
| 21 | b--; |
| 22 | } |
| 23 | |
| 24 | return NULL; |
| 25 | } |