SQLite

Check-in [7180874592]
Login

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

Overview
Comment:Check for multiple calls to sqlite3FailedMalloc(). Ignore the second and subsequent calls. (CVS 3691)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7180874592ffcaf8e2fe3c3b6b37449654da709b
User & Date: danielk1977 2007-03-15 15:33:32.000
Context
2007-03-15
15:35
Save an if(...) clause made redundant by (3691). (CVS 3692) (check-in: 8153edf8be user: danielk1977 tags: trunk)
15:33
Check for multiple calls to sqlite3FailedMalloc(). Ignore the second and subsequent calls. (CVS 3691) (check-in: 7180874592 user: danielk1977 tags: trunk)
12:51
Fix the pager so that it handles persistent I/O errors correctly. Update the testing infrastructure so that it tests for persistent I/O errors instead of just transient errors. (CVS 3690) (check-in: ea8507a796 user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/util.c.
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24







-
+







**
*************************************************************************
** Utility functions used throughout sqlite.
**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.193 2006/09/15 07:28:51 drh Exp $
** $Id: util.c,v 1.194 2007/03/15 15:33:32 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <stdarg.h>
#include <ctype.h>

/*
1457
1458
1459
1460
1461
1462
1463

1464
1465
1466




1467
1468
1469
1470
1471
1472
1473
1457
1458
1459
1460
1461
1462
1463
1464



1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475







+
-
-
-
+
+
+
+







  return (mallocHasFailed && sqlite3OsInMutex(1));
}

/* 
** Set the "malloc has failed" condition to true for this thread.
*/
void sqlite3FailedMalloc(){
  if( !sqlite3MallocFailed() ){
  sqlite3OsEnterMutex();
  assert( mallocHasFailed==0 );
  mallocHasFailed = 1;
    sqlite3OsEnterMutex();
    assert( mallocHasFailed==0 );
    mallocHasFailed = 1;
  }
}

#ifdef SQLITE_MEMDEBUG
/*
** This function sets a flag in the thread-specific-data structure that will
** cause an assert to fail if sqliteMalloc() or sqliteRealloc() is called.
*/