{"thread":{"id":"4555","subject":"[PATCH 3/3] git-tar-tree: no more void pointer arithmetic","startedAt":"2006-06-18T10:58:01Z","lastAt":"2006-06-18T10:58:01Z","messageCount":1,"participants":["Rene Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"22008","messageId":"11506282812751-git-send-email-rene.scharfe@lsrfire.ath.cx","threadId":"4555","inReplyTo":null,"subject":"[PATCH 3/3] git-tar-tree: no more void pointer arithmetic","fromName":"Rene Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2006-06-18T10:58:01Z","receivedAt":"2006-06-18T10:58:01Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Noticed by Florian Forster: Use a char pointer when adding offsets,\nbecause void pointer arithmetic is a GNU extension.   Const'ify the\nfunction arguments while we're at it.\n\nSigned-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>\n---\n builtin-tar-tree.c |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-tar-tree.c b/builtin-tar-tree.c\nindex f646c5b..03dd8be 100644\n--- a/builtin-tar-tree.c\n+++ b/builtin-tar-tree.c\n@@ -22,8 +22,10 @@ static unsigned long offset;\n static time_t archive_time;\n \n /* tries hard to write, either succeeds or dies in the attempt */\n-static void reliable_write(void *buf, unsigned long size)\n+static void reliable_write(const void *data, unsigned long size)\n {\n+\tconst char *buf = data;\n+\n \twhile (size > 0) {\n \t\tlong ret = xwrite(1, buf, size);\n \t\tif (ret < 0) {\n@@ -51,8 +53,9 @@ static void write_if_needed(void)\n  * queues up writes, so that all our write(2) calls write exactly one\n  * full block; pads writes to RECORDSIZE\n  */\n-static void write_blocked(void *buf, unsigned long size)\n+static void write_blocked(const void *data, unsigned long size)\n {\n+\tconst char *buf = data;\n \tunsigned long tail;\n \n \tif (offset) {\n-- \n1.4.0\n"}]}