On Tue, Mar 5, 2013 at 4:01 AM, Michael Meeks <michael.meeks@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
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.