From 1be266ba089bf463f1b0a5ea2839b7a1341d91ab Mon Sep 17 00:00:00 2001 From: drh Date: Sun, 24 Dec 2017 00:18:47 +0000 Subject: Remove the ExprSpan object. Instead, keep track of the test of subphrases in the parse using the "scanpt" non-terminal. FossilOrigin-Name: 3eab7bdc44e0878b83dc86f27058a40c2ffafeacadc566f03693f6dc7e40a504 --- src/expr.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/expr.c') diff --git a/src/expr.c b/src/expr.c index 524e53934..129c1299b 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1654,17 +1654,20 @@ void sqlite3ExprListSetName( void sqlite3ExprListSetSpan( Parse *pParse, /* Parsing context */ ExprList *pList, /* List to which to add the span. */ - ExprSpan *pSpan /* The span to be added */ + const char *zStart, /* Start of the span */ + const char *zEnd /* End of the span */ ){ sqlite3 *db = pParse->db; assert( pList!=0 || db->mallocFailed!=0 ); if( pList ){ struct ExprList_item *pItem = &pList->a[pList->nExpr-1]; + int n; assert( pList->nExpr>0 ); - assert( db->mallocFailed || pItem->pExpr==pSpan->pExpr ); sqlite3DbFree(db, pItem->zSpan); - pItem->zSpan = sqlite3DbStrNDup(db, (char*)pSpan->zStart, - (int)(pSpan->zEnd - pSpan->zStart)); + while( sqlite3Isspace(zStart[0]) ) zStart++; + n = (int)(zEnd - zStart); + while( n>0 && sqlite3Isspace(zStart[n-1]) ) n--; + pItem->zSpan = sqlite3DbStrNDup(db, zStart, n); } } -- cgit v1.2.3 From 9b2e0435d2f1d993af09645d6b03320c8e638d74 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 27 Dec 2017 19:43:22 +0000 Subject: Add and use the internal sqlite3DbSpanDup() interface. FossilOrigin-Name: a8e1545cb7aacb6a26a8c92a3ad4a3d584d150c3a00d2828c8adbb1ee19fcb6d --- src/expr.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/expr.c') diff --git a/src/expr.c b/src/expr.c index 129c1299b..1592f1040 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1661,13 +1661,9 @@ void sqlite3ExprListSetSpan( assert( pList!=0 || db->mallocFailed!=0 ); if( pList ){ struct ExprList_item *pItem = &pList->a[pList->nExpr-1]; - int n; assert( pList->nExpr>0 ); sqlite3DbFree(db, pItem->zSpan); - while( sqlite3Isspace(zStart[0]) ) zStart++; - n = (int)(zEnd - zStart); - while( n>0 && sqlite3Isspace(zStart[n-1]) ) n--; - pItem->zSpan = sqlite3DbStrNDup(db, zStart, n); + pItem->zSpan = sqlite3DbSpanDup(db, zStart, zEnd); } } -- cgit v1.2.3