From: Alex Riesen <raa.lkml@gmail.com>
To: Boyd Lynn Gerber <gerberb@zenez.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH] progress.c: avoid use of dynamic-sized array
Date: Sun, 8 Jun 2008 23:34:38 +0200 [thread overview]
Message-ID: <20080608213438.GA3073@steel.home> (raw)
In-Reply-To: <Pine.LNX.4.64.0806080924330.18454@xenau.zenez.com>
Boyd Lynn Gerber, Sun, Jun 08, 2008 17:26:15 +0200:
> /* Force the last update */
> - char buf[strlen(msg) + 5];
> + char buf[128], *bufp;
> + size_t len = strlen(msg) + 5;
> struct throughput *tp = progress->throughput;
> +
> + bufp = (len < sizeof(buf)) ? buf : xmalloc(len + 1);
It is just a temporary buffer, there is no urgent need to
micro-optimize the allocation like that. Maybe just leave
one of the buffers, the one on stack? It is just a progress
message, snprintf will cut it, yes, but it is unlikely to
cause any harm (unless you forget to \n-terminate it).
next prev parent reply other threads:[~2008-06-08 21:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-08 15:26 [PATCH] progress.c: avoid use of dynamic-sized array Boyd Lynn Gerber
2008-06-08 19:30 ` Johannes Schindelin
2008-06-08 19:52 ` Boyd Lynn Gerber
2008-06-08 21:34 ` Alex Riesen [this message]
2008-06-08 21:50 ` しらいしななこ
2008-06-08 22:02 ` Junio C Hamano
[not found] ` <200806082151.m58Lp6sH014324@mi0.bluebottle.com>
2008-06-08 21:53 ` Boyd Lynn Gerber
-- strict thread matches above, loose matches on Subject: below --
2008-06-08 15:28 [PATCH] Port to 12 other Platforms Boyd Lynn Gerber
2008-06-08 15:46 ` Jakub Narebski
2008-06-08 16:04 ` Boyd Lynn Gerber
2008-06-08 18:52 ` Junio C Hamano
2008-06-08 20:47 ` Boyd Lynn Gerber
2008-06-08 21:19 ` Junio C Hamano
2008-06-08 21:37 ` [PATCH] progress.c: avoid use of dynamic-sized array Boyd Lynn Gerber
2008-06-06 19:34 [PATCH] This patch is to allow 12 different OS's to compile and run git Boyd Lynn Gerber
2008-06-06 19:39 ` Jeremy Maitin-Shepard
2008-06-06 20:02 ` Boyd Lynn Gerber
2008-06-06 23:08 ` Junio C Hamano
2008-06-06 23:23 ` Boyd Lynn Gerber
2008-06-07 0:38 ` [PATCH] 0002 " Boyd Lynn Gerber
2008-06-07 0:47 ` Daniel Barkalow
2008-06-07 1:25 ` [PATCH] 0003 " Boyd Lynn Gerber
2008-06-07 2:12 ` Junio C Hamano
2008-06-07 2:40 ` Boyd Lynn Gerber
2008-06-07 3:40 ` Daniel Barkalow
2008-06-08 3:46 ` Boyd Lynn Gerber
2008-06-08 7:45 ` Junio C Hamano
2008-06-08 16:57 ` [PATCH] progress.c: avoid use of dynamic-sized array Boyd Lynn Gerber
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080608213438.GA3073@steel.home \
--to=raa.lkml@gmail.com \
--cc=gerberb@zenez.com \
--cc=git@vger.kernel.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox