[tarantool-patches] [PATCH v2 3/9] Removes unused functions.
Stanislav Zudin
szudin at tarantool.org
Wed May 29 17:01:25 MSK 2019
Part of #3978
---
src/box/sql/hwtime.h | 63 --------------------------------------------
src/box/sql/main.c | 21 ---------------
src/box/sql/malloc.c | 48 ---------------------------------
src/box/sql/sqlInt.h | 8 ------
4 files changed, 140 deletions(-)
diff --git a/src/box/sql/hwtime.h b/src/box/sql/hwtime.h
index 278a1bf1c..f2196360b 100644
--- a/src/box/sql/hwtime.h
+++ b/src/box/sql/hwtime.h
@@ -43,34 +43,6 @@
* processor and returns that value. This can be used for high-res
* profiling.
*/
-#if (defined(__GNUC__) || defined(_MSC_VER)) && \
- (defined(i386) || defined(__i386__) || defined(_M_IX86))
-
-#if defined(__GNUC__)
-
-__inline__ sql_uint64
-sqlHwtime(void)
-{
- unsigned int lo, hi;
- __asm__ __volatile__("rdtsc":"=a"(lo), "=d"(hi));
- return (sql_uint64) hi << 32 | lo;
-}
-
-#elif defined(_MSC_VER)
-
-__declspec(naked)
-__inline sql_uint64 __cdecl
-sqlHwtime(void)
-{
- __asm {
- rdtsc ret;
- return value at EDX:EAX}
-}
-
-#endif
-
-#elif (defined(__GNUC__) && defined(__x86_64__))
-
__inline__ sql_uint64
sqlHwtime(void)
{
@@ -79,39 +51,4 @@ sqlHwtime(void)
return val;
}
-#elif (defined(__GNUC__) && defined(__ppc__))
-
-__inline__ sql_uint64
-sqlHwtime(void)
-{
- unsigned long long retval;
- unsigned long junk;
- __asm__ __volatile__("\n\
- 1: mftbu %1\n\
- mftb %L0\n\
- mftbu %0\n\
- cmpw %0,%1\n\
- bne 1b":"=r"(retval), "=r"(junk));
- return retval;
-}
-
-#else
-
-#error Need implementation of sqlHwtime() for your platform.
-
- /*
- * To compile without implementing sqlHwtime() for your platform,
- * you can remove the above #error and use the following
- * stub function. You will lose timing support for many
- * of the debugging and testing utilities, but it should at
- * least compile and run.
- */
-sql_uint64
-sqlHwtime(void)
-{
- return ((sql_uint64) 0);
-}
-
-#endif
-
#endif /* !defined(SQL_HWTIME_H) */
diff --git a/src/box/sql/main.c b/src/box/sql/main.c
index fe1135a71..a188f2e8a 100644
--- a/src/box/sql/main.c
+++ b/src/box/sql/main.c
@@ -513,27 +513,6 @@ sql_create_function_v2(sql * db,
return rc;
}
-#ifndef SQL_OMIT_TRACE
-/* Register a trace callback using the version-2 interface.
- */
-int
-sql_trace_v2(sql * db, /* Trace this connection */
- unsigned mTrace, /* Mask of events to be traced */
- int (*xTrace) (unsigned, void *, void *, void *), /* Callback to invoke */
- void *pArg) /* Context */
-{
- if (mTrace == 0)
- xTrace = 0;
- if (xTrace == 0)
- mTrace = 0;
- db->mTrace = mTrace;
- db->xTrace = xTrace;
- db->pTraceArg = pArg;
- return SQL_OK;
-}
-
-#endif /* SQL_OMIT_TRACE */
-
/*
* This function returns true if main-memory should be used instead of
* a temporary file for transient pager files and statement journals.
diff --git a/src/box/sql/malloc.c b/src/box/sql/malloc.c
index ef10d64ae..4bb96111f 100644
--- a/src/box/sql/malloc.c
+++ b/src/box/sql/malloc.c
@@ -253,15 +253,6 @@ sqlHeapNearlyFull(void)
return mem0.nearlyFull;
}
-/*
- * Deinitialize the memory allocation subsystem.
- */
-void
-sqlMallocEnd(void)
-{
- memset(&mem0, 0, sizeof(mem0));
-}
-
/*
* Return the amount of memory currently checked out.
*/
@@ -273,19 +264,6 @@ sql_memory_used(void)
return res;
}
-/*
- * Return the maximum amount of memory that has ever been
- * checked out since either the beginning of this process
- * or since the most recent reset.
- */
-sql_int64
-sql_memory_highwater(int resetFlag)
-{
- sql_int64 res, mx;
- sql_status64(SQL_STATUS_MEMORY_USED, &res, &mx, resetFlag);
- return mx;
-}
-
/*
* Trigger the alarm
*/
@@ -421,14 +399,6 @@ sqlDbMallocSize(sql * db, void *p)
return db->lookaside.sz;
}
-sql_uint64
-sql_msize(void *p)
-{
- assert(sqlMemdebugNoType(p, (u8) ~ MEMTYPE_HEAP));
- assert(sqlMemdebugHasType(p, MEMTYPE_HEAP));
- return p ? sql_sized_sizeof(p) : 0;
-}
-
/*
* Free memory previously obtained from sqlMalloc().
*/
@@ -545,14 +515,6 @@ sqlRealloc(void *pOld, u64 nBytes)
* The public interface to sqlRealloc. Make sure that the memory
* subsystem is initialized prior to invoking sqlRealloc.
*/
-void *
-sql_realloc(void *pOld, int n)
-{
- if (n < 0)
- n = 0; /* IMP: R-26507-47431 */
- return sqlRealloc(pOld, n);
-}
-
void *
sql_realloc64(void *pOld, sql_uint64 n)
{
@@ -777,16 +739,6 @@ sqlDbStrNDup(sql * db, const char *z, u64 n)
return zNew;
}
-/*
- * Free any prior content in *pz and replace it with a copy of zNew.
- */
-void
-sqlSetString(char **pz, sql * db, const char *zNew)
-{
- sqlDbFree(db, *pz);
- *pz = sqlDbStrDup(db, zNew);
-}
-
/*
* Call this routine to record the fact that an OOM (out-of-memory) error
* has happened. This routine will set db->mallocFailed, and also
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index c179a958e..a5f0fba16 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -398,18 +398,12 @@ sql_malloc(int);
void *
sql_malloc64(sql_uint64);
-void *
-sql_realloc(void *, int);
-
void *
sql_realloc64(void *, sql_uint64);
void
sql_free(void *);
-sql_uint64
-sql_msize(void *);
-
int
sql_stricmp(const char *, const char *);
@@ -2975,7 +2969,6 @@ unsigned sqlStrlen30(const char *);
#define sqlStrNICmp sql_strnicmp
void sqlMallocInit(void);
-void sqlMallocEnd(void);
void *sqlMalloc(u64);
void *sqlMallocZero(u64);
void *sqlDbMallocZero(sql *, u64);
@@ -3046,7 +3039,6 @@ void sqlTreeViewSelect(TreeView *, const Select *, u8);
void sqlTreeViewWith(TreeView *, const With *);
#endif
-void sqlSetString(char **, sql *, const char *);
void sqlDequote(char *);
/**
--
2.17.1
More information about the Tarantool-patches
mailing list