delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2017/05/16/13:59:00

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT delorie DOT com using -f
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp-workers AT delorie DOT com
Cc: djgpp AT delorie DOT com
Subject: Re: dxe3gen patch: replace memcmp with strncmp
In-Reply-To: <CAA2C=vCkJChtB6bWeToNGG6GuXeFze2EPyaztWZ631XqoBWWPA@mail.gmail.com> (djgpp-workers@delorie.com)
Date: Tue, 16 May 2017 13:58:57 -0400
Message-ID: <xny3tw3cpq.fsf@envy.delorie.com>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> - if (memcmp(opt.excl_prefix[j], name, strlen(opt.excl_prefix[j])) == 0)
> + if (strncmp(opt.excl_prefix[j], name, strlen(opt.excl_prefix[j])) == 0)

If we're going to pass strlen() anyway, what is the down-side of just
calling strcmp() ?  Our strcmp() implementation never reads past the end
of string anyway, should be safe, and faster.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019