{"thread":{"id":"29854","subject":"[PATCH 2/2] Disambiguate PREFIX define in sideband.c","startedAt":"2012-03-06T08:54:36Z","lastAt":"2012-03-06T19:04:40Z","messageCount":4,"participants":["Vincent van Ravesteijn","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"186185","messageId":"1331024077-5736-1-git-send-email-user@vincent-VirtualBox","threadId":"29854","inReplyTo":null,"subject":"[PATCH 1/2] Fix a warning about conversion to float","fromName":"Vincent van Ravesteijn","fromEmail":"vfr@lyx.org","sentAt":"2012-03-06T08:54:36Z","receivedAt":"2012-03-06T08:54:36Z","isPatch":true,"sender":{"key":"vfr@lyx.org","avatar":"https://avatars.githubusercontent.com/u/687868?v=4"},"body":"From: Vincent van Ravesteijn <vfr@lyx.org>\n\nBelow in the same function, val is correctly casted to a float. Do this also\nfor the initialization of x.\n\nSigned-off-by: Vincent van Ravesteijn <vfr@lyx.org>\n---\n bisect.c |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/bisect.c b/bisect.c\nindex 6e186e2..4aeb402 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -536,7 +536,7 @@ static int get_prn(int count) {\n  */\n static int sqrti(int val)\n {\n-\tfloat d, x = val;\n+\tfloat d, x = (float)val;\n \n \tif (val == 0)\n \t\treturn 0;\n@@ -550,6 +550,7 @@ static int sqrti(int val)\n \treturn (int)x;\n }\n \n+\n static struct commit_list *skip_away(struct commit_list *list, int count)\n {\n \tstruct commit_list *cur, *previous;\n-- \n1.7.5.4\n"},{"id":"186184","messageId":"1331024077-5736-2-git-send-email-user@vincent-VirtualBox","threadId":"29854","inReplyTo":"1331024077-5736-1-git-send-email-user@vincent-VirtualBox","subject":"[PATCH 2/2] Disambiguate PREFIX define in sideband.c","fromName":"Vincent van Ravesteijn","fromEmail":"vfr@lyx.org","sentAt":"2012-03-06T08:54:37Z","receivedAt":"2012-03-06T08:54:37Z","isPatch":true,"sender":{"key":"vfr@lyx.org","avatar":"https://avatars.githubusercontent.com/u/687868?v=4"},"body":"From: Vincent van Ravesteijn <vfr@lyx.org>\n\nPREFIX is already used as the prefix for the system path in system_path(..)\nin exec_cmd.c. If PREFIX has been set, this patch prevents a warning that\nPREFIX is being redefined.\n\nSigned-off-by: Vincent van Ravesteijn <vfr@lyx.org>\n---\n sideband.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/sideband.c b/sideband.c\nindex d5ffa1c..7c38fcb 100644\n--- a/sideband.c\n+++ b/sideband.c\n@@ -12,7 +12,7 @@\n  * the remote died unexpectedly.  A flush() concludes the stream.\n  */\n \n-#define PREFIX \"remote:\"\n+#define SIDEBAND_PREFIX \"remote:\"\n \n #define ANSI_SUFFIX \"\\033[K\"\n #define DUMB_SUFFIX \"        \"\n@@ -21,13 +21,13 @@\n \n int recv_sideband(const char *me, int in_stream, int out)\n {\n-\tunsigned pf = strlen(PREFIX);\n+\tunsigned pf = strlen(SIDEBAND_PREFIX);\n \tunsigned sf;\n \tchar buf[LARGE_PACKET_MAX + 2*FIX_SIZE];\n \tchar *suffix, *term;\n \tint skip_pf = 0;\n \n-\tmemcpy(buf, PREFIX, pf);\n+\tmemcpy(buf, SIDEBAND_PREFIX, pf);\n \tterm = getenv(\"TERM\");\n \tif (term && strcmp(term, \"dumb\"))\n \t\tsuffix = ANSI_SUFFIX;\n-- \n1.7.5.4\n"},{"id":"186237","messageId":"7v62ehtv3l.fsf@alter.siamese.dyndns.org","threadId":"29854","inReplyTo":"1331024077-5736-1-git-send-email-user@vincent-VirtualBox","subject":"Re: [PATCH 1/2] Fix a warning about conversion to float","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-06T18:58:22Z","receivedAt":"2012-03-06T18:58:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vincent van Ravesteijn <vfr@lyx.org> writes:\n\n> From: Vincent van Ravesteijn <vfr@lyx.org>\n>\n> Below in the same function, val is correctly casted to a float. Do this also\n> for the initialization of x.\n\nHrm, is it correctly casted or needlessly casted?\n\nIt is unclear what problem you are trying to solve here.\n\n> @@ -550,6 +550,7 @@ static int sqrti(int val)\n>  \treturn (int)x;\n>  }\n>  \n> +\n>  static struct commit_list *skip_away(struct commit_list *list, int count)\n\nHuh?\n"},{"id":"186238","messageId":"7v1up5tut3.fsf@alter.siamese.dyndns.org","threadId":"29854","inReplyTo":"1331024077-5736-2-git-send-email-user@vincent-VirtualBox","subject":"Re: [PATCH 2/2] Disambiguate PREFIX define in sideband.c","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-06T19:04:40Z","receivedAt":"2012-03-06T19:04:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vincent van Ravesteijn <vfr@lyx.org> writes:\n\n> From: Vincent van Ravesteijn <vfr@lyx.org>\n>\n> PREFIX is already used as the prefix for the system path in system_path(..)\n> in exec_cmd.c. If PREFIX has been set, this patch prevents a warning that\n> PREFIX is being redefined.\n\nIf I recall correctly -DPREFIX= is given only when compiling that\nsingle file in order to limit the knowledge of the actual value, and\nis not given when compiling sideband.c, so it is unclear what\nproblem you are trying to solve here.\n\nIn any case, it probably makes sense to rename _both_ symbols to\nmake them more descriptive.  In the context of Makefile, PREFIX is\nperfectly fine symbol to define the common prefix for installation\npath (I would rather see it all in lowercase, but this dates back to\nthe very original Makefile by Linus), but in the context of the\nwhole source file, PREFIX doesn't not tell us what kind of prefix it\nis about.\n"}]}