aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2005-05-19 08:42:59 +0000
committerdanielk1977 <danielk1977@noemail.net>2005-05-19 08:42:59 +0000
commit1f55c05660a23840ff127eaad855ca6d5deb50ef (patch)
treec860686b9737f1369f7cba5627e743fb3604c72c /src
parentdd9f8b45ef63de1bdcdb462d9477e2bfe54a394f (diff)
downloadsqlite-1f55c05660a23840ff127eaad855ca6d5deb50ef.tar.gz
sqlite-1f55c05660a23840ff127eaad855ca6d5deb50ef.zip
Always use a more specific type (P3_FUNCDEF) instead of P3_POINTER as the
P3 type of a vdbe instruction. (CVS 2463) FossilOrigin-Name: 79a41674be2c0a1990598428d8b1e9d09d3ea389
Diffstat (limited to 'src')
-rw-r--r--src/select.c4
-rw-r--r--src/vdbe.h5
-rw-r--r--src/vdbeaux.c22
3 files changed, 15 insertions, 16 deletions
diff --git a/src/select.c b/src/select.c
index f72e228d7..e02d28c92 100644
--- a/src/select.c
+++ b/src/select.c
@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
-** $Id: select.c,v 1.246 2005/05/16 22:37:55 drh Exp $
+** $Id: select.c,v 1.247 2005/05/19 08:43:00 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -2836,7 +2836,7 @@ int sqlite3Select(
if( !pColl ) pColl = pParse->db->pDfltColl;
sqlite3VdbeOp3(v, OP_CollSeq, 0, 0, (char *)pColl, P3_COLLSEQ);
}
- sqlite3VdbeOp3(v, OP_AggFunc, 0, nExpr, (char*)pDef, P3_POINTER);
+ sqlite3VdbeOp3(v, OP_AggFunc, 0, nExpr, (char*)pDef, P3_FUNCDEF);
}
}
diff --git a/src/vdbe.h b/src/vdbe.h
index 903b67612..31bf8021f 100644
--- a/src/vdbe.h
+++ b/src/vdbe.h
@@ -15,7 +15,7 @@
** or VDBE. The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
-** $Id: vdbe.h,v 1.94 2005/03/23 01:48:48 drh Exp $
+** $Id: vdbe.h,v 1.95 2005/05/19 08:43:00 danielk1977 Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
@@ -38,7 +38,7 @@ struct VdbeOp {
int p1; /* First operand */
int p2; /* Second parameter (often the jump destination) */
char *p3; /* Third parameter */
- int p3type; /* P3_STATIC, P3_DYNAMIC or P3_POINTER */
+ int p3type; /* One of the P3_xxx constants defined below */
#ifdef VDBE_PROFILE
int cnt; /* Number of times this instruction was executed */
long long cycles; /* Total time spend executing this instruction */
@@ -64,7 +64,6 @@ typedef struct VdbeOpList VdbeOpList;
#define P3_NOTUSED 0 /* The P3 parameter is not used */
#define P3_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */
#define P3_STATIC (-2) /* Pointer to a static string */
-#define P3_POINTER (-3) /* P3 is a pointer to some structure or object */
#define P3_COLLSEQ (-4) /* P3 is a pointer to a CollSeq structure */
#define P3_FUNCDEF (-5) /* P3 is a pointer to a FuncDef structure */
#define P3_KEYINFO (-6) /* P3 is a pointer to a KeyInfo structure */
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index 260640b34..9e6c9ba01 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -332,12 +332,17 @@ void sqlite3VdbeChangeP2(Vdbe *p, int addr, int val){
** A value of n==0 means copy bytes of zP3 up to and including the
** first null byte. If n>0 then copy n+1 bytes of zP3.
**
-** If n==P3_STATIC it means that zP3 is a pointer to a constant static
-** string and we can just copy the pointer. n==P3_POINTER means zP3 is
-** a pointer to some object other than a string. n==P3_COLLSEQ and
-** n==P3_KEYINFO mean that zP3 is a pointer to a CollSeq or KeyInfo
-** structure. A copy is made of KeyInfo structures into memory obtained
-** from sqliteMalloc.
+** If n==P3_KEYINFO it means that zP3 is a pointer to a KeyInfo structure.
+** A copy is made of the KeyInfo structure into memory obtained from
+** sqliteMalloc, to be freed when the Vdbe is finalized.
+** n==P3_KEYINFO_HANDOFF indicates that zP3 points to a KeyInfo structure
+** stored in memory that the caller has obtained from sqliteMalloc. The
+** caller should not free the allocation, it will be freed when the Vdbe is
+** finalized.
+**
+** Other values of n (P3_STATIC, P3_COLLSEQ etc.) indicate that zP3 points
+** to a string or structure that is guaranteed to exist for the lifetime of
+** the Vdbe. In these cases we can just copy the pointer.
**
** If addr<0 then change P3 on the most recently inserted instruction.
*/
@@ -463,11 +468,6 @@ static char *displayP3(Op *pOp, char *zTemp, int nTemp){
char *zP3;
assert( nTemp>=20 );
switch( pOp->p3type ){
- case P3_POINTER: {
- sprintf(zTemp, "ptr(%#x)", (int)pOp->p3);
- zP3 = zTemp;
- break;
- }
case P3_KEYINFO: {
int i, j;
KeyInfo *pKeyInfo = (KeyInfo*)pOp->p3;