From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Cc: Junio C Hamano <gitster@pobox.com>, Andreas Ericsson <ae@op5.se>,
Git Mailing List <git@vger.kernel.org>,
Michael Gernoth <simigern@cip.informatik.uni-erlangen.de>,
Thomas Glanzmann <thomas@glanzmann.de>
Subject: Re: [PATCH 4/3] archive: specfile syntax change: "$Format:%PLCHLDR$" instead of just "%PLCHLDR"
Date: Thu, 6 Sep 2007 18:11:04 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0709061803590.28586@racer.site> (raw)
In-Reply-To: <46E028B9.2090908@lsrfire.ath.cx>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1351 bytes --]
Hi,
On Thu, 6 Sep 2007, René Scharfe wrote:
> As suggested by Johannes, --pretty=format: placeholders in specfiles
> need to be wrapped in $Format:...$ now.
Thanks.
> diff --git a/builtin-archive.c b/builtin-archive.c
> index faccce3..a8a0f01 100644
> --- a/builtin-archive.c
> +++ b/builtin-archive.c
> @@ -81,14 +81,58 @@ static int run_remote_archiver(const char *remote, int argc,
> return !!rv;
> }
>
> +static void *format_specfile(const struct commit *commit, const char *format,
> + unsigned long *sizep)
Should this not be "char *buffer" instead of "const char *format"? Or
even better: a "struct strbuf *"?
> +{
> + unsigned long len = *sizep, result_len = 0;
> + const char *a = format;
> + char *result = NULL;
> +
> + for (;;) {
> + const char *b, *c;
> + char *fmt, *formatted = NULL;
> + unsigned long a_len, fmt_len, formatted_len, allocated = 0;
Maybe initialise formatted_len, just to be on the safe side?
> +
> + b = memchr(a, '$', len);
> + if (!b || a + len < b + 9 || memcmp(b + 1, "Format:", 7))
> + break;
Wouldn't memmem(buffer, len, "$Format:", 8) be better here?
A general comment: since you plan to output the result into a file anyway,
it should be even easier to avoid realloc(), and do a
print_formatted_specfile() instead of a format_specfile(), no?
Ciao,
Dscho
next prev parent reply other threads:[~2007-09-06 17:11 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-03 18:07 [PATCH 2/3] archive: specfile support (--pretty=format: in archive files) René Scharfe
2007-09-03 18:40 ` Johannes Schindelin
2007-09-03 20:19 ` David Kastrup
2007-09-04 23:13 ` René Scharfe
2007-09-03 23:53 ` Junio C Hamano
2007-09-04 5:45 ` Andreas Ericsson
2007-09-04 10:41 ` Johannes Schindelin
2007-09-04 23:13 ` René Scharfe
2007-09-05 0:12 ` Johannes Schindelin
2007-09-05 0:23 ` Junio C Hamano
2007-09-06 16:20 ` [PATCH 4/3] archive: specfile syntax change: "$Format:%PLCHLDR$" instead of just "%PLCHLDR" René Scharfe
2007-09-06 17:11 ` Johannes Schindelin [this message]
2007-09-06 20:35 ` René Scharfe
2007-09-06 20:53 ` René Scharfe
2007-09-06 23:17 ` Junio C Hamano
2007-09-07 10:44 ` Johannes Schindelin
2007-09-06 22:32 ` [PATCH 3.5/3] add memmem() René Scharfe
2007-09-06 22:34 ` [PATCH 4/3] archive: specfile syntax change: "$Format:%PLCHLDR$" instead of just "%PLCHLDR" (take 2) René Scharfe
2007-09-06 16:51 ` [PATCH 5/3] archive: rename attribute specfile to export-subst René Scharfe
2007-09-06 17:13 ` Johannes Schindelin
2007-09-06 20:38 ` René Scharfe
2007-09-06 21:03 ` Junio C Hamano
2007-09-07 10:45 ` Johannes Schindelin
2007-09-04 23:13 ` [PATCH 2/3] archive: specfile support (--pretty=format: in archive files) René Scharfe
2007-09-05 0:19 ` Junio C Hamano
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=Pine.LNX.4.64.0709061803590.28586@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=ae@op5.se \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rene.scharfe@lsrfire.ath.cx \
--cc=simigern@cip.informatik.uni-erlangen.de \
--cc=thomas@glanzmann.de \
/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).