From: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>
To: Denton Liu <liu.denton@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>, Jeff King <peff@peff.net>
Subject: Re: [PATCH v2] pkt-line: use string versions of functions
Date: Mon, 15 Jun 2020 19:32:57 +0700 [thread overview]
Message-ID: <20200615123257.GA20389@danh.dev> (raw)
In-Reply-To: <da9ba5fb2d0fb9481f81ce525cbabaedd722858d.1592125442.git.liu.denton@gmail.com>
On 2020-06-14 05:07:54-0400, Denton Liu <liu.denton@gmail.com> wrote:
> Hi Đoàn,
Sorry for this late reply, I have another stuff to work on.
> Perhaps something like this?
This looks better, but ...
>
> pkt-line.c | 48 ++++++++++++++++++++++++++++++------------------
> 1 file changed, 30 insertions(+), 18 deletions(-)
>
> diff --git a/pkt-line.c b/pkt-line.c
> index 8f9bc68ee2..022376f00f 100644
> --- a/pkt-line.c
> +++ b/pkt-line.c
> @@ -81,49 +81,61 @@ static void packet_trace(const char *buf, unsigned int len, int write)
> strbuf_release(&out);
> }
>
> +static inline void packet_trace_str(const char *buf, int write)
> +{
> + packet_trace(buf, strlen(buf), write);
> +}
> +
> +#define control_packet_write(fd, s, errstr) \
> + do { \
> + (void)s"is a string constant"; \
If we are going to not wrap s inside () here,
> + packet_trace_str((s), 1); \
I see no point in wrapping it here.
And wrapping around "string" is not standard C,
some (or most) compilers support it as an extension.
See USE_PARENS_AROUND_GETTEXT_N
Can we just put it straight?
packet_trace(s, strlen(s), 1);
> + if (write_str_in_full((fd), (s)) < 0) \
> + die_errno((errstr)); \
> + } while (0)
> +
--
Danh
next prev parent reply other threads:[~2020-06-15 12:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-13 13:43 [PATCH] pkt-line: extract out PACKET_HEADER_SIZE Denton Liu
2020-06-13 14:23 ` Đoàn Trần Công Danh
2020-06-13 14:39 ` Denton Liu
2020-06-13 16:51 ` Junio C Hamano
2020-06-14 18:24 ` Junio C Hamano
2020-06-14 7:31 ` [PATCH v2 0/3] pkt-line: war on magical `4` literal Denton Liu
2020-06-14 7:31 ` [PATCH v2 1/3] remote-curl: use strlen() instead of magic numbers Denton Liu
2020-06-14 7:31 ` [PATCH v2 2/3] pkt-line: use string versions of functions Denton Liu
2020-06-14 8:31 ` Đoàn Trần Công Danh
2020-06-14 9:07 ` [PATCH v2] " Denton Liu
2020-06-14 21:35 ` Junio C Hamano
2020-06-14 22:28 ` Denton Liu
2020-06-15 12:32 ` Đoàn Trần Công Danh [this message]
2020-06-14 7:32 ` [PATCH v2 3/3] pkt-line: extract out PACKET_HEADER_SIZE Denton Liu
2020-06-14 21:32 ` [PATCH v2 0/3] pkt-line: war on magical `4` literal Junio C Hamano
2020-06-23 17:55 ` [PATCH v3 " Denton Liu
2020-06-23 17:55 ` [PATCH v3 1/3] remote-curl: use strlen() instead of magic numbers Denton Liu
2020-06-23 18:54 ` Jeff King
2020-06-23 19:39 ` Junio C Hamano
2020-06-23 17:55 ` [PATCH v3 2/3] pkt-line: use string versions of functions Denton Liu
2020-06-23 19:11 ` Jeff King
2020-06-23 17:55 ` [PATCH v3 3/3] pkt-line: extract out PACKET_HEADER_SIZE Denton Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200615123257.GA20389@danh.dev \
--to=congdanhqx@gmail.com \
--cc=git@vger.kernel.org \
--cc=liu.denton@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).