Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / zypp / Glob.cc
index 7a776e8..0ff1eaf 100644 (file)
@@ -23,16 +23,26 @@ namespace zypp
   namespace filesystem
   { /////////////////////////////////////////////////////////////////
 
-    int Glob::add( const std::string & pattern_r, Flags flags_r )
+    int Glob::add( const char * pattern_r, Flags flags_r )
     {
-      static Flags _APPEND( GLOB_APPEND ); // not published
+      static Flags kAppend( GLOB_APPEND ); // not published
       if ( ! flags_r )
         flags_r = _defaultFlags;
       if ( _result )
-        flags_r |= _APPEND;
+        flags_r |= kAppend;
       else
         _result.reset( new ::glob_t );
-      return( _lastGlobReturn = ::glob( pattern_r.c_str(), flags_r, NULL, &(*_result) ) );
+      return( _lastGlobReturn = ::glob( pattern_r, flags_r, NULL, &(*_result) ) );
+    }
+
+    void Glob::clear()
+    {
+      if ( _result )
+      {
+        ::globfree( &(*_result) );
+        _result.reset();
+        _lastGlobReturn = 0;
+      }
     }
 
     /******************************************************************