summaryrefslogtreecommitdiff
path: root/common/util.c
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2015-01-07 11:03:51 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-08 00:38:13 +0000
commitdc1362ca82e72ac488bb25d308c97aaf733274fc (patch)
treede3023bc3c0c9362afaf30d030287f1df27722a4 /common/util.c
parent18d3bde7f89cb0bf62e3703d1954791dbb2a0df3 (diff)
downloadchrome-ec-dc1362ca82e72ac488bb25d308c97aaf733274fc.tar.gz
Queue: Add methods that accept a memcpy routine
These versions of the queue add and remove methods support using memcpy like routines to access regions of memory with specific requirements. In particular, this will allow for transfers between queues and USB packet RAM on the STM32 which has specific access requirements. This change also includes an update to the mem* util routines to make their prototypes compatible with C89 and POSIX standards. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Test USB Echo functionality on discovery-stm32f072 board to ensure that queues still function correctly. Change-Id: I557064d99abfc3e8cfc98099a1d94334a976550c Reviewed-on: https://chromium-review.googlesource.com/239217 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Trybot-Ready: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'common/util.c')
-rw-r--r--common/util.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/common/util.c b/common/util.c
index f1c3e9a41e..2b745e8621 100644
--- a/common/util.c
+++ b/common/util.c
@@ -58,7 +58,7 @@ int strcasecmp(const char *s1, const char *s2)
}
-int strncasecmp(const char *s1, const char *s2, int size)
+int strncasecmp(const char *s1, const char *s2, size_t size)
{
int diff;
@@ -155,7 +155,7 @@ int parse_bool(const char *s, int *dest)
}
}
-int memcmp(const void *s1, const void *s2, int len)
+int memcmp(const void *s1, const void *s2, size_t len)
{
const char *sa = s1;
const char *sb = s2;
@@ -171,7 +171,7 @@ int memcmp(const void *s1, const void *s2, int len)
}
-void *memcpy(void *dest, const void *src, int len)
+void *memcpy(void *dest, const void *src, size_t len)
{
char *d = (char *)dest;
const char *s = (const char *)src;
@@ -215,7 +215,7 @@ void *memcpy(void *dest, const void *src, int len)
}
-void *memset(void *dest, int c, int len)
+void *memset(void *dest, int c, size_t len)
{
char *d = (char *)dest;
uint32_t cccc;
@@ -253,7 +253,7 @@ void *memset(void *dest, int c, int len)
}
-void *memmove(void *dest, const void *src, int len)
+void *memmove(void *dest, const void *src, size_t len)
{
if ((uintptr_t)dest <= (uintptr_t)src ||
(uintptr_t)dest >= (uintptr_t)src + len) {