Remove csync_misc: The code no longer use fnmatch
authorOlivier Goffart <ogoffart@woboq.com>
Wed, 7 Nov 2018 10:09:41 +0000 (11:09 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:20 +0000 (10:58 +0100)
src/csync/CMakeLists.txt
src/csync/ConfigureChecks.cmake
src/csync/config_csync.h.cmake
src/csync/csync_exclude.cpp
src/csync/csync_macros.h [deleted file]
src/csync/csync_misc.cpp [deleted file]
src/csync/csync_misc.h [deleted file]

index 8d59f8d5acc598144e891e8c320db3e5be0fb44e..eefa413393913781123669205e8ea53f73f0af36 100644 (file)
@@ -32,7 +32,6 @@ endif()
 set(csync_SRCS
   csync_exclude.cpp
   csync_util.cpp
-  csync_misc.cpp
 
   std/c_alloc.c
   std/c_string.c
index e035e2ebbaa815e79a5d5d8becd790e378c4f2c9..d6a028ce804568bc8c60423efb548eab03b1261d 100644 (file)
@@ -27,12 +27,6 @@ endif (NOT LINUX)
 
 check_function_exists(asprintf HAVE_ASPRINTF)
 
-check_function_exists(fnmatch HAVE_FNMATCH)
-if(NOT HAVE_FNMATCH AND WIN32)
-  find_library(SHLWAPI_LIBRARY shlwapi)
-  set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} shlwapi)
-endif()
-
 if(WIN32)
   set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} psapi kernel32)
 endif()
index 9a8043f1b8cd67da5092bb433b9dc056295cef12..aff1bb74457d6c2124db5705056d7ce5d7685f9a 100644 (file)
@@ -12,7 +12,6 @@
 #cmakedefine HAVE_STRERROR_R 1
 #cmakedefine HAVE_UTIMES 1
 #cmakedefine HAVE_LSTAT 1
-#cmakedefine HAVE_FNMATCH 1
 
 #cmakedefine HAVE___MINGW_ASPRINTF 1
 #cmakedefine HAVE_ASPRINTF 1
index c21b1e00c601808e10902aa9871d147796b0c16c..3a752b06987b03bbdfd35c613dda567f675ac6ef 100644 (file)
@@ -29,7 +29,6 @@
 #include "c_utf8.h"
 
 #include "csync_exclude.h"
-#include "csync_misc.h"
 
 #include "common/utility.h"
 #include "../version.h"
diff --git a/src/csync/csync_macros.h b/src/csync/csync_macros.h
deleted file mode 100644 (file)
index 492bc6b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * cynapses libc functions
- *
- * Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
- * Copyright (c) 2012-2013 by Klaas Freitag <freitag@owncloud.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef _CSYNC_MACROS_H
-#define _CSYNC_MACROS_H
-
-#include <cstdlib>
-#include <cstring>
-
-/* How many elements there are in a static array */
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
-
-/* Some special custom errno values to report bugs properly. The BASE value
- * should always be larger than the highest system errno. */
-#define CSYNC_CUSTOM_ERRNO_BASE 10000
-
-#define ERRNO_WRONG_CONTENT          (CSYNC_CUSTOM_ERRNO_BASE+11)
-#define ERRNO_SERVICE_UNAVAILABLE    (CSYNC_CUSTOM_ERRNO_BASE+14)
-#define ERRNO_STORAGE_UNAVAILABLE    (CSYNC_CUSTOM_ERRNO_BASE+17)
-#define ERRNO_FORBIDDEN              (CSYNC_CUSTOM_ERRNO_BASE+18)
-
-#endif /* _CSYNC_MACROS_H */
-/* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */
diff --git a/src/csync/csync_misc.cpp b/src/csync/csync_misc.cpp
deleted file mode 100644 (file)
index bd6f9a6..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * libcsync -- a library to sync a directory with another
- *
- * Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
- * Copyright (c) 2012-2013 by Klaas Freitag <freitag@owncloud.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config_csync.h"
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <climits>
-#include <cstring>
-#include <cstdlib>
-#include <cstdio>
-#include <sys/types.h>
-#include <cerrno>
-
-#if _WIN32
-# ifndef _WIN32_IE
-#  define _WIN32_IE 0x0501 // SHGetSpecialFolderPath
-# endif
-# include <shlobj.h>
-#else /* _WIN32 */
-# include <pwd.h>
-#endif /* _WIN32 */
-
-#include "c_lib.h"
-#include "csync_misc.h"
-#include "csync_macros.h"
-
-#ifdef HAVE_FNMATCH
-#include <fnmatch.h>
-
-int csync_fnmatch(__const char *__pattern, __const char *__name, int __flags) {
-    return fnmatch(__pattern, __name, __flags);
-}
-
-#else /* HAVE_FNMATCH */
-
-#include <shlwapi.h>
-int csync_fnmatch(const char *pattern, const char *name, int flags) {
-    BOOL match;
-
-    (void) flags;
-
-    match = PathMatchSpecA(name, pattern);
-
-    if(match)
-        return 0;
-    else
-        return 1;
-}
-#endif /* HAVE_FNMATCH */
-
diff --git a/src/csync/csync_misc.h b/src/csync/csync_misc.h
deleted file mode 100644 (file)
index a68ff78..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * libcsync -- a library to sync a directory with another
- *
- * Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
- * Copyright (c) 2012-2013 by Klaas Freitag <freitag@owncloud.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef _CSYNC_MISC_H
-#define _CSYNC_MISC_H
-
-#include <config_csync.h>
-#include <csync.h>
-
-#ifdef HAVE_FNMATCH
-#include <fnmatch.h>
-#else
-/* Steal this define to make csync_exclude compile. Note that if fnmatch
- * is not defined it's probably Win32 which uses a different implementation
- * than fmmatch anyway, which does not care for flags.
- **/
-#define FNM_PATHNAME    (1 << 0) /* No wildcard can ever match `/'.  */
-#define FNM_CASEFOLD    (1 << 4) /* Compare without regard to case.  */
-#endif
-
-int csync_fnmatch(const char *pattern, const char *name, int flags);
-
-#endif /* _CSYNC_MISC_H */