From f0f9f75443d818c84a5cb7dd4c2a629c97201cc3 Mon Sep 17 00:00:00 2001 From: danielk1977 Date: Wed, 17 Dec 2008 15:49:51 +0000 Subject: [PATCH] Fix some strict-aliasing problems in fts3_expr.c. (CVS 6035) FossilOrigin-Name: 20a4ca5d361ecbb982129171f10cccac4f5ad093 --- ext/fts3/fts3_expr.c | 16 ++++++++-------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ext/fts3/fts3_expr.c b/ext/fts3/fts3_expr.c index 546dcba9fa..e0561ca4b6 100644 --- a/ext/fts3/fts3_expr.c +++ b/ext/fts3/fts3_expr.c @@ -155,12 +155,12 @@ static int getNextToken( return rc; } -void realloc_or_free(void **ppOrig, int nNew){ - void *pRet = sqlite3_realloc(*ppOrig, nNew); +void *realloc_or_free(void *pOrig, int nNew){ + void *pRet = sqlite3_realloc(pOrig, nNew); if( !pRet ){ - sqlite3_free(*ppOrig); + sqlite3_free(pOrig); } - *ppOrig = pRet; + return pRet; } /* @@ -198,8 +198,8 @@ static int getNextString( rc = pModule->xNext(pCursor, &zToken, &nToken, &iBegin, &iEnd, &iPos); if( rc==SQLITE_OK ){ int nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase); - realloc_or_free((void **)&p, nByte+ii*sizeof(struct PhraseToken)); - realloc_or_free((void **)&zTemp, nTemp + nToken); + p = realloc_or_free(p, nByte+ii*sizeof(struct PhraseToken)); + zTemp = realloc_or_free(zTemp, nTemp + nToken); if( !p || !zTemp ){ goto no_mem; } @@ -232,7 +232,7 @@ static int getNextString( int nNew = 0; int nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase); nByte += (p->pPhrase->nToken-1) * sizeof(struct PhraseToken); - realloc_or_free((void **)&p, nByte + nTemp); + p = realloc_or_free(p, nByte + nTemp); if( !p ){ goto no_mem; } @@ -308,7 +308,7 @@ static int getNextNode( } /* See if we are dealing with a keyword. */ - for(ii=0; ii