{"thread":{"id":"43539","subject":"Re: [PATCH] Add verbose comments to split_msg()","startedAt":"2006-12-11T22:12:51Z","lastAt":"2006-12-12T08:20:06Z","messageCount":3,"participants":["Andreas Ericsson","Junio C Hamano","Andy Parkins"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"298588","messageId":"200612112212.51533.andyparkins@gmail.com","threadId":"43539","inReplyTo":null,"subject":"[PATCH] Add verbose comments to split_msg()","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2006-12-11T22:12:51Z","receivedAt":"2006-12-11T22:12:51Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"I was going to fix a bug in imap-send that was making it include the \"From \"\nline from git-format-patch in the message sent to the IMAP server.  So I\ncommented up what split_msg already does.\n\nIt turns out the bug was fixed in commit\ne0b0830726286287744cc9e1a629a534bbe75452.  So comments only, no fix needed.\n(cherry picked from 3d5b1768f15b5cd430b869f416e72f4f3afe3d4a commit)\n\nSigned-off-by: Andy Parkins <andyparkins@gmail.com>\n---\n imap-send.c |   13 +++++++++++++\n 1 files changed, 13 insertions(+), 0 deletions(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex a6a6568..110bd54 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -1216,35 +1216,48 @@ split_msg( msg_data_t *all_msgs, msg_data_t *msg, int *ofs )\n {\n \tchar *p, *data;\n \n+\t/* Clear this message's slot */\n \tmemset( msg, 0, sizeof *msg );\n+\t/* If we've run out of data, stop*/\n \tif (*ofs >= all_msgs->len)\n \t\treturn 0;\n \n+\t/* Point at the next message chunk */\n \tdata = &all_msgs->data[ *ofs ];\n+\t/* This message length is at most, the length of all messages\n+\t * minus our current position */\n \tmsg->len = all_msgs->len - *ofs;\n \n+\t/* If there isn't enough data remaining for a whole message or there\n+\t * is no , give up */\n \tif (msg->len < 5 || strncmp( data, \"From \", 5 ))\n \t\treturn 0;\n \n+\t/* Find the end of the \"From \" line */\n \tp = strchr( data, '\\n' );\n \tif (p) {\n+\t\t/* Skip this line from the outgoing buffer */\n \t\tp = &p[1];\n \t\tmsg->len -= p-data;\n \t\t*ofs += p-data;\n \t\tdata = p;\n \t}\n \n+\t/* Find the next message (if any) */\n \tp = strstr( data, \"\\nFrom \" );\n \tif (p)\n \t\tmsg->len = &p[1] - data;\n \n+\t/* Alloc enough space for this message */\n \tmsg->data = xmalloc( msg->len + 1 );\n \tif (!msg->data)\n \t\treturn 0;\n \n+\t/* Copy the message from \"all\" to it's own holder and terminate */\n \tmemcpy( msg->data, data, msg->len );\n \tmsg->data[ msg->len ] = 0;\n \n+\t/* Move the data pointer to the next message */\n \t*ofs += msg->len;\n  \treturn 1;\n }\n-- \n1.4.4.1.geeee8\n\n"},{"id":"295395","messageId":"7vzm9tzzgt.fsf@assigned-by-dhcp.cox.net","threadId":"43539","inReplyTo":"200612112212.51533.andyparkins@gmail.com","subject":"Re: [PATCH] Add verbose comments to split_msg()","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-12-12T01:15:30Z","receivedAt":"2006-12-12T01:15:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andy Parkins <andyparkins@gmail.com> writes:\n\n> I was going to fix a bug in imap-send that was making it include the \"From \"\n> line from git-format-patch in the message sent to the IMAP server.  So I\n> commented up what split_msg already does.\n>\n> It turns out the bug was fixed in commit\n> e0b0830726286287744cc9e1a629a534bbe75452.  So comments only, no fix needed.\n> (cherry picked from 3d5b1768f15b5cd430b869f416e72f4f3afe3d4a commit)\n>\n> Signed-off-by: Andy Parkins <andyparkins@gmail.com>\n\n3d5b1768 is not a public commit and is not useful information\nother than your self.  Please omit the last line.\n\n        Linus and everybody was right and I was wrong to leave this\n        message default in git-cherry-pick for a long time.\n\n> ---\n>  imap-send.c |   13 +++++++++++++\n>  1 files changed, 13 insertions(+), 0 deletions(-)\n>\n> diff --git a/imap-send.c b/imap-send.c\n> index a6a6568..110bd54 100644\n> --- a/imap-send.c\n> +++ b/imap-send.c\n> @@ -1216,35 +1216,48 @@ split_msg( msg_data_t *all_msgs, msg_data_t *msg, int *ofs )\n>  {\n>  \tchar *p, *data;\n>  \n> +\t/* Clear this message's slot */\n>  \tmemset( msg, 0, sizeof *msg );\n> +\t/* If we've run out of data, stop*/\n\n\"..., stop */\"\n\n>  \tif (*ofs >= all_msgs->len)\n>  \t\treturn 0;\n>  \n> +\t/* Point at the next message chunk */\n>  \tdata = &all_msgs->data[ *ofs ];\n> +\t/* This message length is at most, the length of all messages\n> +\t * minus our current position */\n\nStyle?\n\n/*\n * This message ...\n * ... position.\n */\n\n>  \tmsg->len = all_msgs->len - *ofs;\n>  \n> +\t/* If there isn't enough data remaining for a whole message or there\n> +\t * is no , give up */\n\n\"there is no , \"???\n"},{"id":"295367","messageId":"457E6636.7010407@op5.se","threadId":"43539","inReplyTo":"7vzm9tzzgt.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Add verbose comments to split_msg()","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2006-12-12T08:20:06Z","receivedAt":"2006-12-12T08:20:06Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> Andy Parkins <andyparkins@gmail.com> writes:\n> \n>>  \n>> +\t/* If there isn't enough data remaining for a whole message or there\n>> +\t * is no , give up */\n> \n> \"there is no , \"???\n> \n\nspoon\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\n"}]}