www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2017/05/16/13:59:04

X-Authentication-Warning: delorie.com: mail set sender to djgpp-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
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp 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