From mboxrd@z Thu Jan 1 00:00:00 1970 From: Remi Lespinet Subject: [PATCH/RFC v4 07/10] send-email: reduce dependancies impact on parse_address_line Date: Thu, 18 Jun 2015 01:48:34 +0200 (CEST) Message-ID: <989982277.592587.1434584914349.JavaMail.zimbra@ensimag.grenoble-inp.fr> References: <1434550720-24130-1-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr> <1434550720-24130-7-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: git@vger.kernel.org, Remi Galan , Guillaume Pages , Louis-Alexandre Stuber , Antoine Delaite , Matthieu Moy To: Junio C Hamano X-From: git-owner@vger.kernel.org Thu Jun 18 01:47:16 2015 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z5N35-00041B-EC for gcvg-git-2@plane.gmane.org; Thu, 18 Jun 2015 01:47:15 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753396AbbFQXrL (ORCPT ); Wed, 17 Jun 2015 19:47:11 -0400 Received: from zm-etu-ensimag-2.grenet.fr ([130.190.244.118]:52047 "EHLO zm-etu-ensimag-2.grenet.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752080AbbFQXrJ (ORCPT ); Wed, 17 Jun 2015 19:47:09 -0400 Received: from localhost (localhost [127.0.0.1]) by zm-smtpout-2.grenet.fr (Postfix) with ESMTP id 79E6A292A; Thu, 18 Jun 2015 01:47:07 +0200 (CEST) Received: from zm-smtpout-2.grenet.fr ([127.0.0.1]) by localhost (zm-smtpout-2.grenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Jacgl+y-WxRL; Thu, 18 Jun 2015 01:47:07 +0200 (CEST) Received: from zm-int-mbx4.grenet.fr (zm-int-mbx4.grenet.fr [130.190.242.143]) by zm-smtpout-2.grenet.fr (Postfix) with ESMTP id 65B4F2928; Thu, 18 Jun 2015 01:47:07 +0200 (CEST) In-Reply-To: X-Originating-IP: [130.190.242.136] X-Mailer: Zimbra 8.0.9_GA_6191 (ZimbraWebClient - FF38 (Linux)/8.0.9_GA_6191) Thread-Topic: send-email: reduce dependancies impact on parse_address_line Thread-Index: sluhZO36/kqxmsS0NMejmEJH3TakNw== Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: > Junio C Hamano writes > Suffix "rgx" that means "regular expression" is a bit unusual, and > also hard to read when squashed to another word. Elsewhere in the > same script, we seem to use $re_whatever to store precompiled > regular expressions, so perhaps $re_comment, $re_quote, etc.? Yes it's indeed a better name. I had not seen it, thanks! > > + if ($str_address ne "" && $str_phrase ne "") { > > + $str_address = qq[<$str_address>]; > > + } > > We see both "git@vger.kernel.org" and "" around > here for an address without comment or phrase; this chooses to turn > them both into "" form? Not a complaint but am > thinking aloud to see if I am reading it correctly. If there's no phrase, this will choose the "git@vger.kernel.org" form, in both cases, because it'll be recognize as an address, $str_address will be "git@vger.kernel.org" and $str_phrase will be empty before the if ($str_address ne "" ...) Here are some tests: Input: Split: jdoe@example.com M::A : jdoe@example.com ---------- Input: jdoe@example.com Split: jdoe@example.com M::A : jdoe@example.com ---------- Input: Jane Split: Jane M::A : Jane ---------- Input: Jane Doe Split: Jane Doe M::A : Jane Doe ---------- Input: "Jane" Split: "Jane" M::A : "Jane" ---------- Input: "Doe, Jane" Split: "Doe, Jane" M::A : "Doe, Jane" I've some more tests, maybe I should put them all in this post ?