From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17476 invoked by alias); 16 Mar 2007 12:52:50 -0000 Received: (qmail 17467 invoked by uid 22791); 16 Mar 2007 12:52:49 -0000 X-Spam-Check-By: sourceware.org Received: from romy.inter.net.il (HELO romy.inter.net.il) (213.8.233.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 16 Mar 2007 12:52:43 +0000 Received: from HOME-C4E4A596F7 (IGLD-80-230-157-79.inter.net.il [80.230.157.79]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id HKB74452 (AUTH halo1); Fri, 16 Mar 2007 14:52:39 +0200 (IST) Date: Fri, 16 Mar 2007 12:52:00 -0000 Message-Id: From: Eli Zaretskii To: Pedro Alves CC: gdb-patches@sourceware.org In-reply-to: <45F9FC33.9020106@portugalmail.pt> (message from Pedro Alves on Fri, 16 Mar 2007 02:08:51 +0000) Subject: Re: [New WinCE support] [patch 4/4] The bulk of the code. Reply-to: Eli Zaretskii References: <20070315235008.243411000@portugalmail.pt> <45F9FC33.9020106@portugalmail.pt> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00152.txt.bz2 > Date: Fri, 16 Mar 2007 02:08:51 +0000 > From: Pedro Alves > > 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?