git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Riesen <raa.lkml@gmail.com>
To: Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil>
Cc: Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: What's cooking in git.git (Mar 2010, #06; Wed, 24)
Date: Fri, 26 Mar 2010 00:11:51 +0100	[thread overview]
Message-ID: <81b0412b1003251611h62222eabw247ec59678c198ad@mail.gmail.com> (raw)
In-Reply-To: <25yNvbuAivZlBuEJoRhXtfoEc7HEZorM5qOrwgQKk7FER_fdzljyMQ@cipher.nrlssc.navy.mil>

On Thu, Mar 25, 2010 at 17:27, Brandon Casey
<brandon.casey.ctr@nrlssc.navy.mil> wrote:
> On 03/25/2010 10:11 AM, Nguyen Thai Ngoc Duy wrote:
>> 2010/3/25 Junio C Hamano <gitster@pobox.com>:
>>> * ar/config-from-command-line (2010-03-19) 1 commit
>>>  - Allow passing of configuration parameters in the command line
>> This breaks my build on Solaris because it uses strndup, which is not available.
>
> A quick glance at ar/config-from.. also detected an unchecked calloc().
>
> Alex, any reason xcalloc wasn't used?

Just missed it. Long time away from Git sources.

> btw, me also thinks the code is a little hard to read.  For example, I initially
> thought your calloc was not allocating enough space for the nul terminator.
>
>   ct = calloc(1, sizeof(struct config_item) + (text - name));
>   memcpy(ct->name, name, text - name);
>
> I traced the code, but it wasn't until I noticed that your data structure looks
> like this:
>
>   struct config_item
>   {
>          struct config_item *next;
>          char *value;
>          char name[1];
>   };
>
> that I realized that room for the nul terminator in the 'name' array was allocated
> by the structure itself, since the name declaration looks like name[1] and not
> name[FLEX_ARRAY].

Hmm, I kinda liked how the space for the terminator was reserved and
all the flex array incompatibilities were worked around.

> Would the code be simpler if strbufs were used?  Then you wouldn't need to duplicate
> the skip_space and trailing_space functionality provided in the strbuf library, and
> would just need a new function named strbuf_tolower.

But this indeed makes sense. Promise to take a look at it after some sleep.

> Also, should config_parametes_tail be spelled config_parameters_tail?

Yep.

Thanks!

  reply	other threads:[~2010-03-25 23:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-25  0:41 What's cooking in git.git (Mar 2010, #06; Wed, 24) Junio C Hamano
2010-03-25 15:11 ` Nguyen Thai Ngoc Duy
2010-03-25 16:27   ` Brandon Casey
2010-03-25 23:11     ` Alex Riesen [this message]
2010-03-26 22:53       ` [PATCH 1/2] Allow passing of configuration parameters in the command line Alex Riesen
2010-03-26 22:56         ` [PATCH 2/2] Use strbufs instead of open-coded string manipulation Alex Riesen
2010-03-26  5:47     ` What's cooking in git.git (Mar 2010, #06; Wed, 24) Nguyen Thai Ngoc Duy
2010-03-25 15:16 ` Nguyen Thai Ngoc Duy
2010-03-26  2:19 ` Ben Walton
2010-03-26  8:39   ` [PATCH] RPM spec: include bash completion support Ian Ward Comfort
2010-03-26 12:10     ` Ben Walton
2010-03-29 18:17       ` Junio C Hamano
2010-03-26 13:07     ` Julian Phillips

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=81b0412b1003251611h62222eabw247ec59678c198ad@mail.gmail.com \
    --to=raa.lkml@gmail.com \
    --cc=brandon.casey.ctr@nrlssc.navy.mil \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).