This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [New WinCE support] [patch 4/4] The bulk of the code.
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Pedro Alves <pedro_alves at portugalmail dot pt>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 16 Mar 2007 14:53:01 +0200
- Subject: Re: [New WinCE support] [patch 4/4] The bulk of the code.
- References: <20070315235008.243411000@portugalmail.pt> <45F9FC33.9020106@portugalmail.pt>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Fri, 16 Mar 2007 02:08:51 +0000
> From: Pedro Alves <pedro_alves@portugalmail.pt>
>
> This patch is the bulk of the new WinCE support.
Thanks.
I have a few comments.
> +static char *
> +strwinerror (DWORD error)
> +{
> + static char buf[1024];
> + wchar_t msgbuf[1024];
> + DWORD chars = FormatMessageW (
> + FORMAT_MESSAGE_FROM_SYSTEM,
> + NULL,
> + error,
> + 0, /* Default language */
> + (LPVOID)&msgbuf,
> + 0,
> + NULL);
Instead of using an arbitrary size 1024 (btw, you don't check whether
FormatMessageW indicated that it needed more than 1024), isn't it
better to use FORMAT_MESSAGE_ALLOCATE_BUFFER? As a bonus, it would
avoid overwriting the static buffer on each call, which is not a nice
API, IMHO.
> +#ifdef __MINGW32CE__
> + err = strwinerror (GetLastError ());
> +#else
> err = strerror (errno);
> +#endif
Why not call strwinerror strerror and avoid the ifdef?
> doc/ChangeLog
>
> * gdb.texinfo (WinCE): Delete subsection.
Why? Is that subsection incorrect in some ways?