building concat-deps
Norbert Thiebaud
nthiebaud at gmail.com
Tue Mar 5 07:16:20 PST 2013
On Tue, Mar 5, 2013 at 4:01 AM, Michael Meeks <michael.meeks at suse.com> wrote:
> Hi Matus,
>
> On Tue, 2013-03-05 at 10:06 +0100, Matúš Kukan wrote:
>> recently building concat-deps was changed to not use gcc on Windows [1].
>> Is it all right ? Wasn't using gcc deliberate for some reason ?
>
> I imagine it was used because the code was not terribly portable - but
> Peter fixed that; there's no conceptual reason I can think of for
> needing two different compilers on Windows :-) and it simplifies
> configure rather nicely.
well no so nice:
size_t size = end - token + 1;
- char tmp[size];
+ char* tmp=(char *)malloc(size*sizeof(char));
+ #ifdef _MSC_VER
+ // MSVC _snprintf doesn't null terminate strings
+ _snprintf(tmp, size, "%s", token);
+ tmp[size-1]='\0';
+ #else
snprintf(tmp, size, "%s", token);
+ #endif
fputs(tmp, stdout);
fputs(".done ", stdout);
+ free(tmp);
adding few hundred of thousands malloc/free pair to everybody because
Microsoft cannot be bothered to support C99 is not a 'nice' solution.
but then again calling snprintf there was not a great idea either....
when a fwrite(token, 1, end-token, stdout) should do it without alloc
and without temporary copy
Norbert
More information about the LibreOffice
mailing list