git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Ericsson <ae@op5.se>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <junkio@cox.net>,
	Mike McCormack <mike@codeweavers.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] Add git-imap-send.
Date: Thu, 09 Mar 2006 12:39:58 +0100	[thread overview]
Message-ID: <4410140E.2000609@op5.se> (raw)
In-Reply-To: <Pine.LNX.4.63.0603091227560.20277@wbgn013.biozentrum.uni-wuerzburg.de>

Johannes Schindelin wrote:
> 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

  reply	other threads:[~2006-03-09 11:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-06 13:09 [PATCH] Add git-imap-send Mike McCormack
2006-03-09 10:35 ` Junio C Hamano
2006-03-09 11:30   ` Johannes Schindelin
2006-03-09 11:39     ` Andreas Ericsson [this message]
2006-03-09 11:44       ` Johannes Schindelin
2006-03-09 13:26         ` Mark Wooding
2006-03-09 13:47           ` Johannes Schindelin
2006-03-10  0:38             ` Mark Wooding
2006-03-09 16:41     ` Linus Torvalds
2006-03-09 18:09       ` Junio C Hamano
2006-03-09 18:21         ` Linus Torvalds
2006-03-09 18:49           ` Junio C Hamano
2006-03-10  4:58   ` Mike McCormack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4410140E.2000609@op5.se \
    --to=ae@op5.se \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=mike@codeweavers.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).