From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id DC6BA266FE for ; Fri, 29 Jun 2018 06:27:32 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DsHq2jK-7Ur0 for ; Fri, 29 Jun 2018 06:27:32 -0400 (EDT) Received: from smtp16.mail.ru (smtp16.mail.ru [94.100.176.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 9C58D266F1 for ; Fri, 29 Jun 2018 06:27:32 -0400 (EDT) From: Kirill Yukhin Subject: [tarantool-patches] [PATCH] sql: remove LOAD_EXTENSION() support Date: Fri, 29 Jun 2018 13:27:25 +0300 Message-Id: <4301ad6e1f82f87182c8aebf162895cec3d64313.1530015404.git.kyukhin@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: korablev@tarantool.org Cc: tarantool-patches@freelists.org, Kirill Yukhin 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 -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