Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1D4iCM-0008Gt-Oh for mharc-grub-devel@gnu.org; Fri, 25 Feb 2005 11:20:14 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D4iBv-0008Bn-C9 for grub-devel@gnu.org; Fri, 25 Feb 2005 11:19:56 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D4iBe-00082z-DI for grub-devel@gnu.org; Fri, 25 Feb 2005 11:19:32 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D4iBe-00082A-5b for grub-devel@gnu.org; Fri, 25 Feb 2005 11:19:30 -0500 Received: from [209.86.89.61] (helo=smtpauth01.mail.atl.earthlink.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D4hvL-0000iW-Hg for grub-devel@gnu.org; Fri, 25 Feb 2005 11:02:39 -0500 Received: from [63.246.184.80] (helo=[192.168.0.100]) by smtpauth01.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1D4hvJ-0000KH-7a for grub-devel@gnu.org; Fri, 25 Feb 2005 11:02:37 -0500 Mime-Version: 1.0 (Apple Message framework v619.2) In-Reply-To: <421F118C.5000504@yahoo.fr> References: <421A4CEA.5030603@yahoo.fr> <4ecefea8af9852b4ed0a0b046d73e9ee@penguinppc.org> <421D89FF.9010508@yahoo.fr> <200502242030.04298.okuji@enbug.org> <04d445527a7c6174a4040ca0c217751b@penguinppc.org> <421F118C.5000504@yahoo.fr> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <5118c6fb99a015e564cf60860935ce8d@penguinppc.org> Content-Transfer-Encoding: 7bit From: Hollis Blanchard Date: Fri, 25 Feb 2005 10:02:36 -0600 To: The development of GRUB 2 X-Mailer: Apple Mail (2.619.2) X-ELNK-Trace: 77a46389d001b1f223bcf3e39c2f8b5f1aa676d7e74259b7b3291a7d08dfec7912d06576b186d2c89f03156693cd17f5350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 63.246.184.80 Subject: Re: [PATCHv2] dprintf implementation X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Feb 2005 16:19:57 -0000 On Feb 25, 2005, at 5:52 AM, Vincent Pelletier wrote: > > grub_strword (string, word) : searches for word (a serie of > non-word-separators eventualy ended by word-separators) in string (a > succession of 0 or more words which can begin by word-separator(s)) grub_strword looks a little overcomplicated; would something like this work? int grub_strword (const char *haystack, const char *needle) { int pos = 0; int found = 0; while (haystack[pos]) { /* Advance to next word. */ while (grub_iswordseparator (haystack[pos])) pos++; if (0 == grub_strcmp (&haystack[pos], needle)) { found = 1; break; } } return found; } That assumes 'needle' contains no separator characters. I think that's a safe assumption, given that 'needle' should come from a list of #defines. Or we could even sanity-check that in grub_strword, which IMHO would still be simpler than your earlier code. Also, don't forget to add double spaces after periods in comments; otherwise the emacs^W"style" police will kick in your door and make you write 500 ChangeLog entries as punishment. -Hollis