X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com X-Recipient: djgpp AT delorie DOT com X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=S+YAkmhmXl/CE54BJFF+EKYWkxQ88xmeaF/nwnCGz8A=; b=E2/7Io5SvjXfDE8H3NuSyLsANML4TpqqcXREaEBTlSOEYSVj3Z/C9uEE8xRxs5o1Ql rzp9Bp1frrnccQFuWqMOJlZIm75FvDvcWZLUpNsvxeQWk5bPtN8BcokFhoiLM10jXiB7 sZpVwTfHI/PfnFTM16OlCdv2qDjEFZjErDyiC1SdKqIXLXKQg+eW0ILDIvV0u3lDitAj 2d/ovvchxB5uh68VqE/YsEBRv7PgfWKtlDS/eo/cR+oQM4ODq/gUDtHx+Lw/Ry7pvzej yH0Hu6HweWiFCUQe5xdHl1m1UZH7g25GgWAEriqmHQ06N4oCpExpKAqR0XDbDDBLXAAf wAzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=S+YAkmhmXl/CE54BJFF+EKYWkxQ88xmeaF/nwnCGz8A=; b=lUBN++L53A3CGx7xN1w+elVxSUBxCyXKWVR/57cWFJRGrj3Jb1fQ7Duyr+cYEYDVCb 4dqaSujHtw4MuDVHw/A+zdxmaBEdZcuvmHKfCt9pVc90aWIWzYXRtkVzzpvdtOl5eMWK XOAmFrH6grofV85AMpClpZ7JlOv8YDbCOTazRCzu83Ag+VCcdMB69wCuiyG24CSl2hAl EBrTlhOlYIRcsUMwqs+lpPWE47mce3LnGm6DAkXEESVG+5+UgarlsBXTH6yB6Db3JCeb YYluHJ2vyYvx4Jk7cJX/EnX+c6HAHRG4GBh9Xk40DIIaMCLfALM5jyYfX3RTwT8UVFND 9kHw== X-Gm-Message-State: AODbwcDpb/L1KcLsEzc5mtGtSblY0t5it3UkNPFeWmVhiJ3QvD0GShT0 3bLZI+l4adFXX06NOEMt6fWtY8OWsA== X-Received: by 10.55.74.214 with SMTP id x205mr12687380qka.231.1494959692777; Tue, 16 May 2017 11:34:52 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp-workers AT delorie DOT com]" Date: Tue, 16 May 2017 21:34:52 +0300 Message-ID: Subject: Re: dxe3gen patch: replace memcmp with strncmp To: djgpp-workers AT delorie DOT com, djgpp AT delorie DOT com Content-Type: text/plain; charset="UTF-8" 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 Precedence: bulk On 5/16/17, DJ Delorie wrote: >> - 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. > dxe3gen compares the prefix to export or exclude a symbol, e.g. if one does -E _MySym, _MySym itself and also _MySym1 and _MySymbolName2 should count as Ok. Unless I'm missing something, the latter two won't count as Ok with plain strcmp()