SQLite

Check-in [1de98da6b4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove a non-ansi construct from mem1.c - an assert() statement before the variable declarations in a function. (CVS 5280)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1de98da6b4c2039e5dc594cc9bfc7d49ae36697c
User & Date: danielk1977 2008-06-23 14:40:18.000
Context
2008-06-23
15:10
Handle a real system malloc() failure in mem1.c. (CVS 5281) (check-in: 006fd69bf5 user: danielk1977 tags: trunk)
14:40
Remove a non-ansi construct from mem1.c - an assert() statement before the variable declarations in a function. (CVS 5280) (check-in: 1de98da6b4 user: danielk1977 tags: trunk)
14:15
Avoid passing "void(*)(void)" as an argument to va_arg(). Codewarrior doesn't like it. (CVS 5279) (check-in: edae76d6ff user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/mem1.c.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
** This file contains low-level memory allocation drivers for when
** SQLite will use the standard C-library malloc/realloc/free interface
** to obtain the memory it needs.
**
** This file contains implementations of the low-level memory allocation
** routines specified in the sqlite3_mem_methods object.
**
** $Id: mem1.c,v 1.21 2008/06/17 15:12:01 drh Exp $
*/
#include "sqliteInt.h"

/*
** This version of the memory allocator is the default.  It is
** used when no other memory allocator is specified using compile-time
** macros.







|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
** This file contains low-level memory allocation drivers for when
** SQLite will use the standard C-library malloc/realloc/free interface
** to obtain the memory it needs.
**
** This file contains implementations of the low-level memory allocation
** routines specified in the sqlite3_mem_methods object.
**
** $Id: mem1.c,v 1.22 2008/06/23 14:40:18 danielk1977 Exp $
*/
#include "sqliteInt.h"

/*
** This version of the memory allocator is the default.  It is
** used when no other memory allocator is specified using compile-time
** macros.
50
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
** or sqlite3MemRealloc().
**
** For this low-level routine, we already know that pPrior!=0 since
** cases where pPrior==0 will have been intecepted and dealt with
** by higher-level routines.
*/
static void sqlite3MemFree(void *pPrior){
  assert( pPrior!=0 );
  sqlite3_int64 *p = (sqlite3_int64*)pPrior;

  p--;
  free(p);
}

/*
** Like realloc().  Resize an allocation previously obtained from
** sqlite3MemMalloc().







<

>







50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
65
** or sqlite3MemRealloc().
**
** For this low-level routine, we already know that pPrior!=0 since
** cases where pPrior==0 will have been intecepted and dealt with
** by higher-level routines.
*/
static void sqlite3MemFree(void *pPrior){

  sqlite3_int64 *p = (sqlite3_int64*)pPrior;
  assert( pPrior!=0 );
  p--;
  free(p);
}

/*
** Like realloc().  Resize an allocation previously obtained from
** sqlite3MemMalloc().