Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com Message-ID: <025a01c15b58$bcf61ca0$0200a8c0@lifelesswks> From: "Robert Collins" To: "Jonathan Kamens" , References: <20011022202804 DOT 5132 DOT qmail AT lizard DOT curl DOT com> Subject: Re: miscfuncs.cc won't compile with --enable-debugging Date: Tue, 23 Oct 2001 10:22:01 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-OriginalArrivalTime: 23 Oct 2001 00:26:44.0004 (UTC) FILETIME=[64899640:01C15B59] In addition to Chris's comment, I'd like to point out that this function should be as streamlined for speed as possible (it can potentially get called a lot).. this: __check_invalid_read_ptr_errno (const void *s, unsigned sz) { if (s && !IsBadReadPtr ((void *) s, sz)) return 0; set_errno (EFAULT); return EFAULT; } is probably better. (I've been doing a little code tuning research recently. One thing that stood out was that if() tests should have the most common branch as the {}, and drop through to the least common branch. In some cases that would result in ridiculously deep embedded if() {if () {}} constructs, but for issues where performance matters it's probably worth it. Rob ----- Original Message ----- From: "Jonathan Kamens" To: Sent: Tuesday, October 23, 2001 6:28 AM Subject: miscfuncs.cc won't compile with --enable-debugging > Corinna checked a change in today which break miscfuncs.cc when > --enable-debugging is used. Here's a patch: > > Index: miscfuncs.cc > =================================================================== > RCS file: /cvs/src/src/winsup/cygwin/miscfuncs.cc,v > retrieving revision 1.7 > diff -u -r1.7 miscfuncs.cc > --- miscfuncs.cc 2001/10/22 11:31:39 1.7 > +++ miscfuncs.cc 2001/10/22 20:26:55 > @@ -158,7 +158,7 @@ > __check_invalid_read_ptr_errno (const void *s, unsigned sz) > { > if (!s || IsBadReadPtr ((void *) s, sz)) > - return set_errno (EFAULT); > + set_errno (EFAULT); > > - return 0; > + return get_errno(); > } >