]> git.lyx.org Git - lyx.git/commitdiff
small code simplification
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 1 Feb 2008 15:54:40 +0000 (15:54 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 1 Feb 2008 15:54:40 +0000 (15:54 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22736 a592a061-630c-0410-9148-cb99ea01b6c8

src/LaTeXFeatures.cpp

index 15547477c6560919aecc44943232f3daaa03ec02..ecf02295f54f0ec5d1e3c1ee8e5e9bfc5289efd4 100644 (file)
@@ -18,7 +18,6 @@
 
 #include "Color.h"
 #include "BufferParams.h"
-#include "support/debug.h"
 #include "Encoding.h"
 #include "Floating.h"
 #include "FloatList.h"
 #include "LyXRC.h"
 #include "TextClass.h"
 
+#include "support/debug.h"
 #include "support/docstream.h"
 #include "support/FileName.h"
 #include "support/filetools.h"
+#include "support/lstrings.h"
 
 using namespace std;
 using namespace lyx::support;
@@ -414,13 +415,12 @@ bool LaTeXFeatures::mustProvide(string const & name) const
 
 bool LaTeXFeatures::isAvailable(string const & name)
 {
-       string n = name;
        if (packages_.empty())
                getAvailable();
-       size_t loc = n.rfind(".sty");
-       if (loc == n.length() - 4) 
-               n = n.erase(name.length() - 4);
-       return find(packages_.begin(), packages_.end(), n) != packages_.end();
+       string n = name;
+       if (suffixIs(n, ".sty"))
+               n.erase(name.length() - 4);
+       return packages_.find(n) != packages_.end();
 }