From de5dcba183f35aec116f96f77c85e96e6f309fab Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 15 Jul 2007 13:39:54 +0000 Subject: [PATCH] Small cosmetic change in buffer access. Use &buffer[idx] instead of buffer + idx. git-svn-id: svn://jdgordon.mine.nu/mob@52 9862a28c-4e93-4879-ac26-10afcf840a8f --- testplugin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testplugin.c b/testplugin.c index 4612f96..ae63d3a 100644 --- a/testplugin.c +++ b/testplugin.c @@ -111,7 +111,7 @@ static struct memory_handle *add_handle(size_t *data_size) /* make sure buf_widx is 32-bit aligned so that the handle struct is. */ buf_widx = (RINGBUF_ADD(buf_widx, 3)) & ~3; - struct memory_handle *new_handle = (struct memory_handle *)(buffer + buf_widx); + struct memory_handle *new_handle = (struct memory_handle *)(&buffer[buf_widx]); /* only advance the buffer write index of the size of the struct */ buf_widx = RINGBUF_ADD(buf_widx, sizeof(struct memory_handle)); @@ -210,7 +210,7 @@ static struct memory_handle *move_handle(size_t *delta, struct memory_handle *h) size_t newpos = RINGBUF_ADD((void *)h - (void *)buffer, *delta); DEBUGF("move_handle\n"); - struct memory_handle *dest = (struct memory_handle *)(buffer + newpos); + struct memory_handle *dest = (struct memory_handle *)(&buffer[newpos]); /* Invalidate the cache to prevent it from keeping the old location of h */ if (h == cached_handle) @@ -537,7 +537,7 @@ ssize_t bufgetdata(int handle_id, size_t size, unsigned char **data) buffer_len - h->ridx); } - *data = (unsigned char *)(buffer + h->ridx); + *data = (unsigned char *)&buffer[h->ridx]; //DEBUGF("bufgetdata(%d): h->ridx=%ld, ret=%ld\n", handle_id, (long)h->ridx, ret); return ret; -- 2.11.4.GIT