From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 56FF26BD38; Tue, 23 Mar 2021 12:37:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 56FF26BD38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616492269; bh=5xBx9oQgDrFgS2MoQ8VW31Rd7OGI98CDDFKrslf/s3Q=; h=To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=YNl2cOtq/ecwdJxFCEjhcrWbyIvbSkphzJknexH9Au6rM2UBEpsRvnWXbVVQPUlEj C86lajBXKfrL/1lhZKXswdT/T2RGQTKIRsboGUdwLxhve+djRUpflt/I5YEeVeyxFF EcWgMc6B3mdTmJQzDDRQNZv8YLPY0HNNpQ5DuFMs= Received: from smtp42.i.mail.ru (smtp42.i.mail.ru [94.100.177.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 6B6C36BD3A for ; Tue, 23 Mar 2021 12:35:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6B6C36BD3A Received: by smtp42.i.mail.ru with esmtpa (envelope-from ) id 1lOdRK-0000fn-JZ; Tue, 23 Mar 2021 12:35:07 +0300 To: v.shpilevoy@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org Date: Tue, 23 Mar 2021 12:35:00 +0300 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD95D6E7CC48CB1F5F111116110879554077ED795A4341E98F3182A05F5380850407D0011DBA0A1849FDD41B2A3AFBE4303FD72C333A27764D33B2BB46BB1A3DB15 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE77BF46084C0059042EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637145E7A1B378D9E388638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C686AF563A045C75E6C070949F6EC0703E7084CFD4E80C65CA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE767883B903EA3BAEA9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3A7AC412AE061D850117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CFE4353864A4764FFABA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B65612D679C14083DA76E601842F6C81A1F004C906525384307823802FF610243DF43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B3BBE47FD9DD3FB59A8DF7F3B2552694A57739F23D657EF2B13377AFFFEAFD26923F8577A6DFFEA7C054662F8F2CA352F93EC92FD9297F6715571747095F342E857739F23D657EF2BD5E8D9A59859A8B698B1B85E56A716AC089D37D7C0E48F6C5571747095F342E857739F23D657EF2B6825BDBE14D8E7024847893F9AA87235E5BFE6E7EFDEDCD789D4C264860C145E X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C686AF563A045C75E6C070949F6EC0703E7084CFD4E80C65C9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF0417BEADF48D1460699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34F0A5F58274334C95CDEEFA9B6B2FBE991F42C85DC206C4E449E3EE72F44BEA952B0466D05C5DAE2D1D7E09C32AA3244C4550DC508209161A35D745B4510A5BD463871F383B54D9B3FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojWJZv20R+6UjypJS9x1l4cQ== X-Mailru-Sender: 5C3750E245F362008BC1685FEC6306ED46413DA374B1F204DD41B2A3AFBE43036ECF975C7BB2667F5105BD0848736F9966FEC6BF5C9C28D97E07721503EA2E00ED97202A5A4E92BF7402F9BA4338D657ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v4 06/53] sql: remove unused MEM-related functions X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mergen Imeev via Tarantool-patches Reply-To: imeevma@tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch removes remove unused MEM-related functions. Part of #5818 --- src/box/sql/sqlInt.h | 4 --- src/box/sql/vdbe.c | 8 ------ src/box/sql/vdbeInt.h | 2 -- src/box/sql/vdbeapi.c | 62 ----------------------------------------- src/box/sql/vdbemem.c | 65 ------------------------------------------- 5 files changed, 141 deletions(-) diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h index c1a42fc2f..dd8163f5e 100644 --- a/src/box/sql/sqlInt.h +++ b/src/box/sql/sqlInt.h @@ -474,10 +474,6 @@ sql_column_text(sql_stmt *, enum mp_type sql_column_type(sql_stmt *stmt, int field_no); -sql_value * -sql_column_value(sql_stmt *, - int iCol); - /* * Terminate the current execution of an SQL statement and reset * it back to its starting state so that it can be reused. diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c index 21abdcbd5..dbbcc1013 100644 --- a/src/box/sql/vdbe.c +++ b/src/box/sql/vdbe.c @@ -166,14 +166,6 @@ vdbeTakeBranch(int iSrcLine, u8 I, u8 M) } #endif -/* - * Convert the given register into a string if it isn't one - * already. Return non-zero if a malloc() fails. - */ -#define Stringify(P) \ - if(((P)->flags&(MEM_Str|MEM_Blob))==0 && sqlVdbeMemStringify(P)) \ - { goto no_mem; } - /* * An ephemeral string value (signified by the MEM_Ephem flag) contains * a pointer to a dynamically allocated string where some other entity diff --git a/src/box/sql/vdbeInt.h b/src/box/sql/vdbeInt.h index 089ac7575..e619f6e59 100644 --- a/src/box/sql/vdbeInt.h +++ b/src/box/sql/vdbeInt.h @@ -333,8 +333,6 @@ int sqlVdbeList(Vdbe *); int sqlVdbeHalt(Vdbe *); -int sqlVdbeMemFromBtree(BtCursor *, u32, u32, Mem *); - /** * In terms of VDBE memory cell type, _BIN, _ARRAY and _MAP * messagepacks are stored as binary string (i.e. featuring diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c index 24fa99f17..671338361 100644 --- a/src/box/sql/vdbeapi.c +++ b/src/box/sql/vdbeapi.c @@ -101,63 +101,12 @@ sql_stmt_reset(sql_stmt *pStmt) return rc; } -/* - * Set all the parameters in the compiled SQL statement to NULL. - */ -int -sql_clear_bindings(sql_stmt * pStmt) -{ - int i; - int rc = 0; - Vdbe *p = (Vdbe *) pStmt; - for (i = 0; i < p->nVar; i++) { - sqlVdbeMemRelease(&p->aVar[i]); - p->aVar[i].flags = MEM_Null; - } - return rc; -} - bool sql_metadata_is_full() { return current_session()->sql_flags & SQL_FullMetadata; } -/* Make a copy of an sql_value object - */ -sql_value * -sql_value_dup(const sql_value * pOrig) -{ - sql_value *pNew; - if (pOrig == 0) - return 0; - pNew = sql_malloc(sizeof(*pNew)); - if (pNew == 0) - return 0; - memset(pNew, 0, sizeof(*pNew)); - memcpy(pNew, pOrig, MEMCELLSIZE); - pNew->flags &= ~MEM_Dyn; - pNew->db = 0; - if (pNew->flags & (MEM_Str | MEM_Blob)) { - pNew->flags &= ~(MEM_Static | MEM_Dyn); - pNew->flags |= MEM_Ephem; - if (sqlVdbeMemMakeWriteable(pNew) != 0) { - sqlValueFree(pNew); - pNew = 0; - } - } - return pNew; -} - -/* Destroy an sql_value object previously obtained from - * sql_value_dup(). - */ -void -sql_value_free(sql_value * pOld) -{ - sqlValueFree(pOld); -} - /**************************** sql_result_ ****************************** * The following routines are used by user-defined functions to specify * the function result. @@ -566,17 +515,6 @@ sql_column_text(sql_stmt * pStmt, int i) return sql_value_text(columnMem(pStmt, i)); } -sql_value * -sql_column_value(sql_stmt * pStmt, int i) -{ - Mem *pOut = columnMem(pStmt, i); - if (pOut->flags & MEM_Static) { - pOut->flags &= ~MEM_Static; - pOut->flags |= MEM_Ephem; - } - return (sql_value *) pOut; -} - enum mp_type sql_column_type(sql_stmt * pStmt, int i) { diff --git a/src/box/sql/vdbemem.c b/src/box/sql/vdbemem.c index d1a9f7e06..85d620a0a 100644 --- a/src/box/sql/vdbemem.c +++ b/src/box/sql/vdbemem.c @@ -44,71 +44,6 @@ #include "box/tuple.h" #include "mpstream/mpstream.h" -/* - * Move data out of a btree key or data field and into a Mem structure. - * The data is payload from the entry that pCur is currently pointing - * to. offset and amt determine what portion of the data or key to retrieve. - * The result is written into the pMem element. - * - * The pMem object must have been initialized. This routine will use - * pMem->zMalloc to hold the content from the btree, if possible. New - * pMem->zMalloc space will be allocated if necessary. The calling routine - * is responsible for making sure that the pMem object is eventually - * destroyed. - * - * If this routine fails for any reason (malloc returns NULL or unable - * to read from the disk) then the pMem is left in an inconsistent state. - */ -static SQL_NOINLINE int -vdbeMemFromBtreeResize(BtCursor * pCur, /* Cursor pointing at record to retrieve. */ - u32 offset, /* Offset from the start of data to return bytes from. */ - u32 amt, /* Number of bytes to return. */ - Mem * pMem /* OUT: Return data in this Mem structure. */ - ) -{ - int rc; - pMem->flags = MEM_Null; - if (0 == (rc = sqlVdbeMemClearAndResize(pMem, amt + 2))) { - sqlCursorPayload(pCur, offset, amt, pMem->z); - pMem->z[amt] = 0; - pMem->z[amt + 1] = 0; - pMem->flags = MEM_Blob | MEM_Term; - pMem->n = (int) amt; - } - return rc; -} - -int -sqlVdbeMemFromBtree(BtCursor * pCur, /* Cursor pointing at record to retrieve. */ - u32 offset, /* Offset from the start of data to return bytes from. */ - u32 amt, /* Number of bytes to return. */ - Mem * pMem /* OUT: Return data in this Mem structure. */ - ) -{ - char *zData; /* Data from the btree layer */ - u32 available = 0; /* Number of bytes available on the local btree page */ - int rc = 0; /* Return code */ - - assert(sqlCursorIsValid(pCur)); - assert(!VdbeMemDynamic(pMem)); - assert(pCur->curFlags & BTCF_TaCursor || - pCur->curFlags & BTCF_TEphemCursor); - - - zData = (char *)tarantoolsqlPayloadFetch(pCur, &available); - assert(zData != 0); - - if (offset + amt <= available) { - pMem->z = &zData[offset]; - pMem->flags = MEM_Blob | MEM_Ephem; - pMem->n = (int)amt; - } else { - rc = vdbeMemFromBtreeResize(pCur, offset, amt, pMem); - } - - return rc; -} - /* * Context object passed by sqlStat4ProbeSetValue() through to * valueNew(). See comments above valueNew() for details. -- 2.25.1