Index: src/window.c ================================================================== --- src/window.c +++ src/window.c @@ -148,13 +148,11 @@ sqlite3_context *pCtx, int nArg, sqlite3_value **apArg ){ i64 *p = (i64*)sqlite3_aggregate_context(pCtx, sizeof(*p)); - /* row_numberValueFunc() is always called first, so the aggregate context - ** is guaranteed to already exist. */ - if( ALWAYS(p) ) (*p)++; + if( p ) (*p)++; UNUSED_PARAMETER(nArg); UNUSED_PARAMETER(apArg); } static void row_numberValueFunc(sqlite3_context *pCtx){ i64 *p = (i64*)sqlite3_aggregate_context(pCtx, sizeof(*p)); @@ -182,12 +180,11 @@ int nArg, sqlite3_value **apArg ){ struct CallCount *p; p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); - /* p is not NULL because dense_rankValueFunc() will have been called first */ - if( ALWAYS(p) ) p->nStep = 1; + if( p ) p->nStep = 1; UNUSED_PARAMETER(nArg); UNUSED_PARAMETER(apArg); } static void dense_rankValueFunc(sqlite3_context *pCtx){ struct CallCount *p; @@ -212,12 +209,11 @@ int nArg, sqlite3_value **apArg ){ struct CallCount *p; p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); - /* p is not NULL because rankValueFunc() will have been called first */ - if( ALWAYS(p) ){ + if( p ){ p->nStep++; if( p->nValue==0 ){ p->nValue = p->nStep; } } @@ -246,12 +242,11 @@ ){ struct CallCount *p; UNUSED_PARAMETER(nArg); assert( nArg==1 ); p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); - /* p is not NULL because percent_rankValueFunc() will have been called */ - if( ALWAYS(p) ){ + if( p ){ if( p->nTotal==0 ){ p->nTotal = sqlite3_value_int64(apArg[0]); } p->nStep++; if( p->nValue==0 ){ @@ -286,12 +281,11 @@ ){ struct CallCount *p; assert( nArg==1 ); UNUSED_PARAMETER(nArg); p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); - /* p is not NULL because cume_distValueFunc() will have been called first */ - if( ALWAYS(p) ){ + if( p ){ if( p->nTotal==0 ){ p->nTotal = sqlite3_value_int64(apArg[0]); } p->nStep++; } @@ -326,12 +320,11 @@ sqlite3_value **apArg ){ struct NtileCtx *p; assert( nArg==2 ); UNUSED_PARAMETER(nArg); p = (struct NtileCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); - /* p is not NULL because ntimeValueFunc() will have been called first */ - if( ALWAYS(p) ){ + if( p ){ if( p->nTotal==0 ){ p->nParam = sqlite3_value_int64(apArg[0]); p->nTotal = sqlite3_value_int64(apArg[1]); if( p->nParam<=0 ){ sqlite3_result_error(