Code Refactoring: Move duplicate macro SQLITE_ERR out of revprop-sqlite.c and mergeinfo-sqlite-index.c to new file include/private/svn_fs_sqlite.h. * subversion/include/private/svn_fs_sqlite.h New file * subversion/libsvn_fs_util/mergeinfo-sqlite-index.c * subversion/libsvn_fs_util/revprop-sqlite.c (): include svn_fs_sqlite.h (SQLITE_ERR): Moved to svn_fs_sqlite.h git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/revprop-sqlite@865688 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/subversion/include/private/svn_fs_sqlite.h b/subversion/include/private/svn_fs_sqlite.h new file mode 100644 index 0000000..6180b2d --- /dev/null +++ b/subversion/include/private/svn_fs_sqlite.h
@@ -0,0 +1,25 @@ +/** + * ==================================================================== + * Copyright (c) 2007 CollabNet. All rights reserved. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://subversion.tigris.org/license-1.html. + * If newer versions of this license are posted there, you may use a + * newer version instead, at your option. + * + * This software consists of voluntary contributions made by many + * individuals. For exact contribution history, see the revision + * history and logs, available at http://subversion.tigris.org/. + * ==================================================================== + */ + +#include <sqlite3.h> + +/* SQLITE->SVN quick error wrap, much like SVN_ERR. */ +#define SQLITE_ERR(x, db) do \ +{ \ + if ((x) != SQLITE_OK) \ + return svn_error_create(SVN_ERR_FS_SQLITE_ERROR, NULL, \ + sqlite3_errmsg((db))); \ +} while (0)
diff --git a/subversion/libsvn_fs_util/mergeinfo-sqlite-index.c b/subversion/libsvn_fs_util/mergeinfo-sqlite-index.c index 63c5f71..b8fb303 100644 --- a/subversion/libsvn_fs_util/mergeinfo-sqlite-index.c +++ b/subversion/libsvn_fs_util/mergeinfo-sqlite-index.c
@@ -32,6 +32,7 @@ #include "private/svn_compat.h" #include "private/svn_fs_mergeinfo.h" +#include "private/svn_fs_sqlite.h" #include "../libsvn_fs/fs-loader.h" #include "svn_private_config.h" @@ -44,14 +45,6 @@ so we use a -1 converted to a pointer to represent this. */ #define NEGATIVE_CACHE_RESULT ((void *)(-1)) -/* SQLITE->SVN quick error wrap, much like SVN_ERR. */ -#define SQLITE_ERR(x, db) do \ -{ \ - if ((x) != SQLITE_OK) \ - return svn_error_create(SVN_ERR_FS_SQLITE_ERROR, NULL, \ - sqlite3_errmsg((db))); \ -} while (0) - #ifdef SQLITE3_DEBUG /* An sqlite query execution callback. */ static void
diff --git a/subversion/libsvn_fs_util/revprop-sqlite.c b/subversion/libsvn_fs_util/revprop-sqlite.c index eb95f44..bcb42b4 100644 --- a/subversion/libsvn_fs_util/revprop-sqlite.c +++ b/subversion/libsvn_fs_util/revprop-sqlite.c
@@ -21,17 +21,10 @@ #include "svn_path.h" #include "private/svn_fs_revprop.h" +#include "private/svn_fs_sqlite.h" #include "../libsvn_fs/fs-loader.h" #include "svn_private_config.h" -/* SQLITE->SVN quick error wrap, much like SVN_ERR. */ -#define SQLITE_ERR(x, db) do \ -{ \ - if ((x) != SQLITE_OK) \ - return svn_error_create(SVN_ERR_FS_SQLITE_ERROR, NULL, \ - sqlite3_errmsg((db))); \ -} while (0) - #ifdef SQLITE3_DEBUG /* An sqlite query execution callback. */ static void