Re: [PATCH 003/160] gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Nov 14, 2010, 21:47 UTC
- Message-ID
- <20101114214731.GA16413@burratino>
- In-Reply-To
- <AANLkTim-j6TLwz0PugZvaEf1x3hW=76vT1gALC=w3DOu@mail.gmail.com>
Ævar Arnfjörð Bjarmason wrote:
Show 21 quoted lines
> This is how it currently gets compiled: > > $ rm git-sh-i18n--envsubst sh-i18n--envsubst.o; make -j 5 all V=1 > gcc -o sh-i18n--envsubst.o -c -g -O2 -Wall -I. -DHAVE_PATHS_H > -DSHA1_HEADER='<openssl/sha.h>' -DNO_STRLCPY -DNO_MKSTEMPS > sh-i18n--envsubst.c > gcc -g -O2 -Wall -I. -DHAVE_PATHS_H > -DSHA1_HEADER='<openssl/sha.h>' -DNO_STRLCPY -DNO_MKSTEMPS -o > git-sh-i18n--envsubst sh-i18n--envsubst.o libgit.a xdiff/lib.a -lz > -lcrypto -lpthread > > I tried to remove some of those library includes. But it'll > complain. However if I do: > > diff --git a/sh-i18n--envsubst.c b/sh-i18n--envsubst.c > index 8db71b1..7d4c870 100644 > --- a/sh-i18n--envsubst.c > +++ b/sh-i18n--envsubst.c > @@ -215 +215 @@ string_list_append (string_list_ty *slp, const char *s) > - slp->item = (const char **) xrealloc (slp->item, nbytes); > + slp->item = (const char **) realloc (slp->item, nbytes);
[...]
> It'll compile stand-alone with no library includes at all.
Yes, that is what $gmane/160842 is about (also see $gmane/137738 for background). In this case, a simple local stub xmalloc/xrealloc etc to take care of checking for NULL seems fine, indeed.