** This function is a no-op if p->errCode is initially other than SQLITE_OK. ** In this case it returns NULL. ** ** Otherwise, an attempt is made to allocate and return a bitmap object ** large enough to store a bit for all page numbers between 1 and nPg, ** inclusive. The bitmap is initially zeroed. */
| 13846 | ** inclusive. The bitmap is initially zeroed. |
| 13847 | */ |
| 13848 | static RecoverBitmap *recoverBitmapAlloc(sqlite3_recover *p, i64 nPg){ |
| 13849 | int nElem = (nPg+1+31) / 32; |
| 13850 | int nByte = sizeof(RecoverBitmap) + nElem*sizeof(u32); |
| 13851 | RecoverBitmap *pRet = (RecoverBitmap*)recoverMalloc(p, nByte); |
| 13852 | |
| 13853 | if( pRet ){ |
| 13854 | pRet->nPg = nPg; |
| 13855 | } |
| 13856 | return pRet; |
| 13857 | } |
| 13858 | |
| 13859 | /* |
| 13860 | ** Free a bitmap object allocated by recoverBitmapAlloc(). |
no test coverage detected