aboutsummaryrefslogtreecommitdiff
path: root/src/rowset.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2009-01-09 01:12:27 +0000
committerdrh <drh@noemail.net>2009-01-09 01:12:27 +0000
commite2f02bacc1b5b1cf3a317b8f7a6b2a8e539b4cfa (patch)
tree09589065b0e979bcd3a008554668fcc06ad33182 /src/rowset.c
parent103bd88cf77e70867eb6937f5c949bf5315a17d5 (diff)
downloadsqlite-e2f02bacc1b5b1cf3a317b8f7a6b2a8e539b4cfa.tar.gz
sqlite-e2f02bacc1b5b1cf3a317b8f7a6b2a8e539b4cfa.zip
Increased test coverage. (CVS 6147)
FossilOrigin-Name: 45bb5703d7ef5e835b43a6fa7ee2a2d96db76939
Diffstat (limited to 'src/rowset.c')
-rw-r--r--src/rowset.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/rowset.c b/src/rowset.c
index 2be962759..012cfc80b 100644
--- a/src/rowset.c
+++ b/src/rowset.c
@@ -73,25 +73,23 @@ struct RowSet {
** for any subsequent allocations that need to occur.
** Return a pointer to the new RowSet object.
**
-** If N is not sufficient memory to make even a minimum RowSet,
-** then return NULL. If N is larger than the minimum, use
-** the surplus as an initial allocation of entries available to
-** be filled.
+** It must be the case that N is sufficient to make a Rowset. If not
+** an assertion fault occurs.
+**
+** If N is larger than the minimum, use the surplus as an initial
+** allocation of entries available to be filled.
*/
RowSet *sqlite3RowSetInit(sqlite3 *db, void *pSpace, unsigned int N){
RowSet *p;
- if( N<sizeof(*p) ){
- p = 0;
- }else{
- p = pSpace;
- p->pChunk = 0;
- p->db = db;
- p->pEntry = 0;
- p->pLast = 0;
- p->pFresh = (struct RowSetEntry*)&p[1];
- p->nFresh = (u16)((N - sizeof(*p))/sizeof(struct RowSetEntry));
- p->isSorted = 1;
- }
+ assert( N >= sizeof(*p) );
+ p = pSpace;
+ p->pChunk = 0;
+ p->db = db;
+ p->pEntry = 0;
+ p->pLast = 0;
+ p->pFresh = (struct RowSetEntry*)&p[1];
+ p->nFresh = (u16)((N - sizeof(*p))/sizeof(struct RowSetEntry));
+ p->isSorted = 1;
return p;
}