aboutsummaryrefslogtreecommitdiffstats
path: root/rawmemelem.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--rawmemelem.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/rawmemelem.c b/rawmemelem.c
index fa67a51..798f275 100644
--- a/rawmemelem.c
+++ b/rawmemelem.c
@@ -8,40 +8,40 @@ libsimple_rawmemelem(const void *hay_, const void *sub_, size_t width)
{
switch (width) {
case 0:
- return (void *)hay_;
+ return REMOVE_CONST(hay_, void *);
case 1:
- return rawmemchr(hay_, *(char *)sub_);
+ return rawmemchr(hay_, *(const char *)sub_);
case 2:
{
- uint16_t *hay = (void *)hay_;
- uint16_t sub = *(uint16_t *)sub_;
+ const uint16_t *hay = hay_;
+ uint16_t sub = *(const uint16_t *)sub_;
for (; *hay != sub; hay++);
- return hay;
+ return REMOVE_CONST(hay, uint16_t *);
}
case 4:
{
- uint32_t *hay = (void *)hay_;
- uint32_t sub = *(uint32_t *)sub_;
+ const uint32_t *hay = hay_;
+ uint32_t sub = *(const uint32_t *)sub_;
for (; *hay != sub; hay++);
- return hay;
+ return REMOVE_CONST(hay, uint32_t *);
}
case 8:
{
- uint64_t *hay = (void *)hay_;
- uint64_t sub = *(uint64_t *)sub_;
+ const uint64_t *hay = hay_;
+ uint64_t sub = *(const uint64_t *)sub_;
for (; *hay != sub; hay++);
- return hay;
+ return REMOVE_CONST(hay, uint64_t *);
}
default:
{
- char *hay = (void *)hay_;
+ const char *hay = hay_;
const char *sub = sub_;
size_t i;
for (;; hay += width) {
for (i = 0; i < width; i++)
if (hay[i] != sub[i])
goto next;
- return hay;
+ return REMOVE_CONST(hay, char *);
next:;
}
}