git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Add git-imap-send.

From
Andreas Ericsson <ae@op5.se>
Date
Mar 9, 2006, 11:39 UTC
Message-ID
<4410140E.2000609@op5.se>
In-Reply-To
<Pine.LNX.4.63.0603091227560.20277@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin wrote:
Show 18 quoted lines
> Hi,
> 
> On Thu, 9 Mar 2006, Junio C Hamano wrote:
> 
> 
>>Mike McCormack <mike@codeweavers.com> writes:
>>
>>
>>>+		if (!memcmp( "imaps:", val, 6 )) {
>>>+			if (!memcmp( "imap:", val, 5 ))
>>
>>Is val always longer than 5 or 6 bytes here?
> 
> 
> That does not matter, since they are strings, and the memcmp should not 
> look further if they are shorter (because the comparison to '\0' failed 
> already).
> 

That's what strcmp() does. memcmp() walks the lenghth even if it encounters nul bytes. Perhaps you confuse it with strncmp()?

> However, if !memcmp("imaps:", val, 6), it means that val starts with 
> the string "imaps:", right? Then !memcmp("imap:", val, 5) must always 
> fail, no?
> 

Yes. Recent gcc's will recognize it as dead code and remove it. It's still ugly though.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 4 of 13 in “Add git-imap-send.”
  1. Add git-imap-send.Mike McCormack, Mar 6, 2006
  2. Junio C HamanoMar 9, 2006
  3. Johannes SchindelinMar 9, 2006
  4. Andreas EricssonMar 9, 2006
  5. Johannes SchindelinMar 9, 2006
  6. Mark WoodingMar 9, 2006
  7. Johannes SchindelinMar 9, 2006
  8. Mark WoodingMar 10, 2006
  9. Linus TorvaldsMar 9, 2006
  10. Junio C HamanoMar 9, 2006
  11. Linus TorvaldsMar 9, 2006
  12. Junio C HamanoMar 9, 2006
  13. Mike McCormackMar 10, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.