Subject: Re: [RFC] Convert builin-mailinfo.c to use The Better String Library.

From: Matthieu Moy <[email-masked]>
Date: Wed, 05 Sep 2007 19:29:24 +0200

Kristian Høgsberg <[email-masked]> writes:

> On Tue, 2007-09-04 at 22:50 +0200, Lukas Sandström wrote:
>> Hi.
>> 
>> This is an attempt to use "The Better String Library"[1] in builtin-mailinfo.c
>> 
>> The patch doesn't pass all the tests in the testsuit yet, but I thought I'd
>> send it out so people can decide if they like how the code looks.
>> 
>> I'm not sending a patch to add the library files at this time. I'll send
>> that patch when this patch is working.
>> 
>> The changes required to make it pass the tests shouldn't be very large.
>
> Please, no.  Let's not pull in a dependency for something as simple as a
> string library.  How many distros have bstring pcakaged?  
> The right version?

That's not a good argument. If dependancy is a problem, bsstring can
easily be distributed as part of git. It's really small, so it wont
make git bloated:

$ wc -l *.c *.h
    82 bsafe.c
  3462 bstest.c
  1134 bstraux.c
  2964 bstrlib.c
   358 testaux.c
    43 bsafe.h
   112 bstraux.h
   302 bstrlib.h
   442 bstrwrap.h
  8899 total

> Does it work on Windows?

The library is totally stand alone, portable (known to work with
gcc/g++, MSVC++, Intel C++, WATCOM C/C++, Turbo C, Borland C++, IBM's
native CC compiler on Windows, Linux and Mac OS X)

> We already have strbuf.c, lets just consolidate the string
> manipulation code already in git under that interface.

The right question is: what does git need. One way to consolidate
strbuf would be to simply

$ rm strbuf.{c,h}
$ unzip bsstring.zip

and if people decide that git needs a non-trivial string library,
writting/testing more code in strbuf.c would probably be more work
than just reading what bsstring code does to become familiar enough
with it to even be able to maintain it later.

If people decide that git needs a really trivial string library, then
a few improvements to stbuf.c can be good.

I'd argue in favor of the first option. C strings are horrible, and I
think doing something pleasant to use and safe is not completely
trivial. But I'm not a big contributor enough to really decide in
spite of others ;-).

-- 
Matthieu