From: Christian Kamm Date: Fri, 19 Oct 2018 08:28:22 +0000 (+0200) Subject: Excludes: drop csyncTraversalMatchFun() X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~468^2~464 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=4f6f706f40fea3f2fa1e37988214689ec48296c7;p=nextcloud-desktop.git Excludes: drop csyncTraversalMatchFun() The new discovery can call the traversal match function directly. --- diff --git a/src/csync/csync_exclude.cpp b/src/csync/csync_exclude.cpp index de0216553..2398d10dd 100644 --- a/src/csync/csync_exclude.cpp +++ b/src/csync/csync_exclude.cpp @@ -562,12 +562,6 @@ CSYNC_EXCLUDE_TYPE ExcludedFiles::fullPatternMatch(const char *path, ItemType fi return CSYNC_NOT_EXCLUDED; } -auto ExcludedFiles::csyncTraversalMatchFun() - -> std::function -{ - return [this](const char *path, ItemType filetype) { return this->traversalPatternMatch(path, filetype); }; -} - /** * On linux we used to use fnmatch with FNM_PATHNAME, but the windows function we used * didn't have that behavior. wildcardsMatchSlash can be used to control which behavior diff --git a/src/csync/csync_exclude.h b/src/csync/csync_exclude.h index c470da13f..10eb65e36 100644 --- a/src/csync/csync_exclude.h +++ b/src/csync/csync_exclude.h @@ -123,14 +123,21 @@ public: void setClientVersion(Version version); /** - * Generate a hook for traversal exclude pattern matching - * that csync can use. + * @brief Check if the given path should be excluded in a traversal situation. + * + * It does only part of the work that full() does because it's assumed + * that all leading directories have been run through traversal() + * before. This can be significantly faster. + * + * That means for 'foo/bar/file' only ('foo/bar/file', 'file') is checked + * against the exclude patterns. * - * Careful: The function will only be valid for as long as this - * ExcludedFiles instance stays alive. + * @param Path is folder-relative, should not start with a /. + * + * Note that this only matches patterns. It does not check whether the file + * or directory pointed to is hidden (or whether it even exists). */ - auto csyncTraversalMatchFun() - -> std::function; + CSYNC_EXCLUDE_TYPE traversalPatternMatch(const char *path, ItemType filetype); public slots: /** @@ -170,23 +177,6 @@ private: */ CSYNC_EXCLUDE_TYPE fullPatternMatch(const char *path, ItemType filetype) const; - /** - * @brief Check if the given path should be excluded in a traversal situation. - * - * It does only part of the work that full() does because it's assumed - * that all leading directories have been run through traversal() - * before. This can be significantly faster. - * - * That means for 'foo/bar/file' only ('foo/bar/file', 'file') is checked - * against the exclude patterns. - * - * @param Path is folder-relative, should not start with a /. - * - * Note that this only matches patterns. It does not check whether the file - * or directory pointed to is hidden (or whether it even exists). - */ - CSYNC_EXCLUDE_TYPE traversalPatternMatch(const char *path, ItemType filetype); - // Our BasePath need to end with '/' class BasePathByteArray : public QByteArray { diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 0aba936c1..e581ae68f 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -265,7 +265,7 @@ void ProcessDirectoryJob::process() bool ProcessDirectoryJob::handleExcluded(const QString &path, bool isDirectory, bool isHidden, bool isSymlink) { // FIXME! call directly, without char* conversion - auto excluded = _discoveryData->_excludes->csyncTraversalMatchFun()(path.toUtf8(), isDirectory ? ItemTypeDirectory : ItemTypeFile); + auto excluded = _discoveryData->_excludes->traversalPatternMatch(path.toUtf8(), isDirectory ? ItemTypeDirectory : ItemTypeFile); // FIXME: move to ExcludedFiles 's regexp ? bool isInvalidPattern = false;