lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 716aec8 1/2: Incorporate a nice micro-optimiz


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 716aec8 1/2: Incorporate a nice micro-optimization (VZ)
Date: Wed, 3 May 2017 18:55:07 -0400 (EDT)

branch: master
commit 716aec803383f2912064490509a7e1299f43a8b2
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Incorporate a nice micro-optimization (VZ)
    
    While iterating over directory entries, checking the file extension is
    presumably cheaper than testing whether the iterator is a directory.
    See:
      http://lists.nongnu.org/archive/html/lmi/2017-01/msg00050.html
---
 ce_product_name.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ce_product_name.cpp b/ce_product_name.cpp
index 5f99602..b0e2a10 100644
--- a/ce_product_name.cpp
+++ b/ce_product_name.cpp
@@ -45,7 +45,7 @@ std::vector<std::string> fetch_product_names()
     fs::directory_iterator end_i;
     for(; i != end_i; ++i)
         {
-        if(is_directory(*i) || ".policy" != fs::extension(*i))
+        if(".policy" != fs::extension(*i) || is_directory(*i))
             {
             continue;
             }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]