Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Yukhin <kyukhin@tarantool.org>
To: korablev@tarantool.org
Cc: tarantool-patches@freelists.org, Kirill Yukhin <kyukhin@tarantool.org>
Subject: [tarantool-patches] [PATCH] sql: remove LOAD_EXTENSION() support
Date: Fri, 29 Jun 2018 13:27:25 +0300	[thread overview]
Message-ID: <4301ad6e1f82f87182c8aebf162895cec3d64313.1530015404.git.kyukhin@tarantool.org> (raw)

If we ever will have extensions support, it will be
impemented in different way. Remove this legacy code.

Closes #2183
---
Issue:n https://github.com/tarantool/tarantool/issues/2183
Branch: https://github.com/tarantool/tarantool/tree/kyukhin/gh-2183-remove-load-ext

 src/box/sql/os.c        | 23 ----------------
 src/box/sql/os.h        |  6 ----
 src/box/sql/os_unix.c   | 73 -------------------------------------------------
 src/box/sql/sqliteInt.h |  5 ----
 4 files changed, 107 deletions(-)

diff --git a/src/box/sql/os.c b/src/box/sql/os.c
index 38d3585..19841bf 100644
--- a/src/box/sql/os.c
+++ b/src/box/sql/os.c
@@ -319,29 +319,6 @@ sqlite3OsFullPathname(sqlite3_vfs * pVfs,
 	return pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut);
 }
 
-#ifndef SQLITE_OMIT_LOAD_EXTENSION
-void *
-sqlite3OsDlOpen(sqlite3_vfs * pVfs, const char *zPath)
-{
-	return pVfs->xDlOpen(pVfs, zPath);
-}
-
-void
-sqlite3OsDlError(sqlite3_vfs * pVfs, int nByte, char *zBufOut)
-{
-	pVfs->xDlError(pVfs, nByte, zBufOut);
-}
-
-void (*sqlite3OsDlSym(sqlite3_vfs * pVfs, void *pHdle, const char *zSym)) (void) {
-	return pVfs->xDlSym(pVfs, pHdle, zSym);
-}
-
-void
-sqlite3OsDlClose(sqlite3_vfs * pVfs, void *pHandle)
-{
-	pVfs->xDlClose(pVfs, pHandle);
-}
-#endif				/* SQLITE_OMIT_LOAD_EXTENSION */
 int
 sqlite3OsRandomness(sqlite3_vfs * pVfs, int nByte, char *zBufOut)
 {
diff --git a/src/box/sql/os.h b/src/box/sql/os.h
index 894a803..500b864 100644
--- a/src/box/sql/os.h
+++ b/src/box/sql/os.h
@@ -175,12 +175,6 @@ int sqlite3OsOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int *);
 int sqlite3OsDelete(sqlite3_vfs *, const char *, int);
 int sqlite3OsAccess(sqlite3_vfs *, const char *, int, int *pResOut);
 int sqlite3OsFullPathname(sqlite3_vfs *, const char *, int, char *);
-#ifndef SQLITE_OMIT_LOAD_EXTENSION
-void *sqlite3OsDlOpen(sqlite3_vfs *, const char *);
-void sqlite3OsDlError(sqlite3_vfs *, int, char *);
-void (*sqlite3OsDlSym(sqlite3_vfs *, void *, const char *)) (void);
-void sqlite3OsDlClose(sqlite3_vfs *, void *);
-#endif				/* SQLITE_OMIT_LOAD_EXTENSION */
 int sqlite3OsRandomness(sqlite3_vfs *, int, char *);
 int sqlite3OsSleep(sqlite3_vfs *, int);
 int sqlite3OsGetLastError(sqlite3_vfs *);
diff --git a/src/box/sql/os_unix.c b/src/box/sql/os_unix.c
index 9cb8a54..fce7cb9 100644
--- a/src/box/sql/os_unix.c
+++ b/src/box/sql/os_unix.c
@@ -4712,75 +4712,6 @@ unixFullPathname(sqlite3_vfs * pVfs,	/* Pointer to vfs object */
 #endif				/* HAVE_READLINK && HAVE_LSTAT */
 }
 
-#ifndef SQLITE_OMIT_LOAD_EXTENSION
-/*
- * Interfaces for opening a shared library, finding entry points
- * within the shared library, and closing the shared library.
- */
-#include <dlfcn.h>
-static void *
-unixDlOpen(sqlite3_vfs * NotUsed, const char *zFilename)
-{
-	UNUSED_PARAMETER(NotUsed);
-	return dlopen(zFilename, RTLD_NOW | RTLD_GLOBAL);
-}
-
-/*
- * SQLite calls this function immediately after a call to unixDlSym() or
- * unixDlOpen() fails (returns a null pointer). If a more detailed error
- * message is available, it is written to zBufOut. If no error message
- * is available, zBufOut is left unmodified and SQLite uses a default
- * error message.
- */
-static void
-unixDlError(sqlite3_vfs * NotUsed, int nBuf, char *zBufOut)
-{
-	const char *zErr;
-	UNUSED_PARAMETER(NotUsed);
-	zErr = dlerror();
-	if (zErr) {
-		sqlite3_snprintf(nBuf, zBufOut, "%s", zErr);
-	}
-}
-
-static
-    void (*unixDlSym(sqlite3_vfs * NotUsed, void *p, const char *zSym)) (void) {
-	/*
-	 * GCC with -pedantic-errors says that C90 does not allow a void* to be
-	 * cast into a pointer to a function.  And yet the library dlsym() routine
-	 * returns a void* which is really a pointer to a function.  So how do we
-	 * use dlsym() with -pedantic-errors?
-	 *
-	 * Variable x below is defined to be a pointer to a function taking
-	 * parameters void* and const char* and returning a pointer to a function.
-	 * We initialize x by assigning it a pointer to the dlsym() function.
-	 * (That assignment requires a cast.)  Then we call the function that
-	 * x points to.
-	 *
-	 * This work-around is unlikely to work correctly on any system where
-	 * you really cannot cast a function pointer into void*.  But then, on the
-	 * other hand, dlsym() will not work on such a system either, so we have
-	 * not really lost anything.
-	 */
-	void (*(*x) (void *, const char *)) (void);
-	UNUSED_PARAMETER(NotUsed);
-	x = (void (*(*)(void *, const char *))(void))dlsym;
-	return (*x) (p, zSym);
-}
-
-static void
-unixDlClose(sqlite3_vfs * NotUsed, void *pHandle)
-{
-	UNUSED_PARAMETER(NotUsed);
-	dlclose(pHandle);
-}
-#else				/* if SQLITE_OMIT_LOAD_EXTENSION is defined: */
-#define unixDlOpen  0
-#define unixDlError 0
-#define unixDlSym   0
-#define unixDlClose 0
-#endif
-
 /*
  * Write nBuf bytes of random data to the supplied buffer zBuf.
  */
@@ -6252,10 +6183,6 @@ sqlite3_os_init(void)
     unixDelete,           /* xDelete */                     \
     unixAccess,           /* xAccess */                     \
     unixFullPathname,     /* xFullPathname */               \
-    unixDlOpen,           /* xDlOpen */                     \
-    unixDlError,          /* xDlError */                    \
-    unixDlSym,            /* xDlSym */                      \
-    unixDlClose,          /* xDlClose */                    \
     unixRandomness,       /* xRandomness */                 \
     unixSleep,            /* xSleep */                      \
     0,			  /* xCurrentTime */                \
diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h
index e7a02dc..2b651cd 100644
--- a/src/box/sql/sqliteInt.h
+++ b/src/box/sql/sqliteInt.h
@@ -357,11 +357,6 @@ struct sqlite3_vfs {
 			int *pResOut);
 	int (*xFullPathname) (sqlite3_vfs *, const char *zName,
 			      int nOut, char *zOut);
-	void *(*xDlOpen) (sqlite3_vfs *, const char *zFilename);
-	void (*xDlError) (sqlite3_vfs *, int nByte, char *zErrMsg);
-	void (*(*xDlSym) (sqlite3_vfs *, void *, const char *zSymbol))
-	(void);
-	void (*xDlClose) (sqlite3_vfs *, void *);
 	int (*xRandomness) (sqlite3_vfs *, int nByte, char *zOut);
 	int (*xSleep) (sqlite3_vfs *, int microseconds);
 	int (*xCurrentTime) (sqlite3_vfs *, double *);
-- 
2.16.2

             reply	other threads:[~2018-06-29 10:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 10:27 Kirill Yukhin [this message]
2018-06-29 12:36 ` [tarantool-patches] " n.pettik
2018-06-29 13:39   ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4301ad6e1f82f87182c8aebf162895cec3d64313.1530015404.git.kyukhin@tarantool.org \
    --to=kyukhin@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH] sql: remove LOAD_EXTENSION() support' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox