summaryrefslogtreecommitdiff
path: root/include/queue.h
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-05-30 11:40:34 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-09 12:10:37 +0000
commitf58d821a5ac305c963722997713c6fc35a4dc6f7 (patch)
treeef366e68fc1cd970272daabe67cd29baea01f8c3 /include/queue.h
parent930e001165c2df0b491288b2a8de1071b58ac6ec (diff)
downloadchrome-ec-f58d821a5ac305c963722997713c6fc35a4dc6f7.tar.gz
Queue: add peek_memcpy function
Add queue_peek_memcpy to peek at queue and move the element using specific memcpy function. Also change memcpy prototype argument from void const * to const void*. BUG=none BRANCH=none TEST=Compile and use. Change-Id: I8c582563e7d204ee5568637f819d63404624faf6 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274226 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'include/queue.h')
-rw-r--r--include/queue.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/include/queue.h b/include/queue.h
index a893b58194..d415b63a68 100644
--- a/include/queue.h
+++ b/include/queue.h
@@ -106,17 +106,17 @@ size_t queue_count(struct queue const *q);
size_t queue_space(struct queue const *q);
/* Add one unit to queue. */
-size_t queue_add_unit(struct queue const *q, void const *src);
+size_t queue_add_unit(struct queue const *q, const void *src);
/* Add multiple units to queue. */
-size_t queue_add_units(struct queue const *q, void const *src, size_t count);
+size_t queue_add_units(struct queue const *q, const void *src, size_t count);
/* Add multiple units to queue using supplied memcpy. */
size_t queue_add_memcpy(struct queue const *q,
- void const *src,
+ const void *src,
size_t count,
void *(*memcpy)(void *dest,
- void const *src,
+ const void *src,
size_t n));
/* Remove one unit from the begin of the queue. */
@@ -130,7 +130,7 @@ size_t queue_remove_memcpy(struct queue const *q,
void *dest,
size_t count,
void *(*memcpy)(void *dest,
- void const *src,
+ const void *src,
size_t n));
/* Peek (return but don't remove) the count elements starting with the i'th. */
@@ -139,6 +139,15 @@ size_t queue_peek_units(struct queue const *q,
size_t i,
size_t count);
+/* Peek (return but don't remove) the count elements starting with the i'th. */
+size_t queue_peek_memcpy(struct queue const *q,
+ void *dest,
+ size_t i,
+ size_t count,
+ void *(*memcpy)(void *dest,
+ const void *src,
+ size_t n));
+
/*
* These macros will statically select the queue functions based on the number
* of units that are to be added or removed if they can. The single unit add