/ Check-in [c637caf1]
Login

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

Overview
Comment:Comment changes to the lemon parser template. Change some sqliteMalloc() calls to sqliteMallocRaw() for speed. Update the website template. (CVS 1114)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c637caf13f579959ecdb6b134d0114e8efbcac60
User & Date: drh 2003-10-22 22:15:28
Context
2003-10-23
15:27
Fix progress test error 1-2 (CVS 1115) check-in: c3a49502 user: peter tags: trunk
2003-10-22
22:15
Comment changes to the lemon parser template. Change some sqliteMalloc() calls to sqliteMallocRaw() for speed. Update the website template. (CVS 1114) check-in: c637caf1 user: drh tags: trunk
2003-10-21
16:34
Fix bugs in lemon associated with the change to a perfect hash table. (CVS 1113) check-in: c0d1b269 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree_rb.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12         -** $Id: btree_rb.c,v 1.16 2003/08/27 22:57:08 drh Exp $
           12  +** $Id: btree_rb.c,v 1.17 2003/10/22 22:15:28 drh Exp $
    13     13   **
    14     14   ** This file implements an in-core database using Red-Black balanced
    15     15   ** binary trees.
    16     16   ** 
    17     17   ** It was contributed to SQLite by anonymous on 2003-Feb-04 23:24:49 UTC.
    18     18   */
    19     19   #include "btree.h"
................................................................................
   750    750     /* Make sure some other cursor isn't trying to read this same table */
   751    751     if( checkReadLocks(pCur) ){
   752    752       return SQLITE_LOCKED; /* The table pCur points to has a read lock */
   753    753     }
   754    754   
   755    755     /* Take a copy of the input data now, in case we need it for the 
   756    756      * replace case */
   757         -  pData = sqliteMalloc(nData);
          757  +  pData = sqliteMallocRaw(nData);
   758    758     memcpy(pData, pDataInput, nData);
   759    759   
   760    760     /* Move the cursor to a node near the key to be inserted. If the key already
   761    761      * exists in the table, then (match == 0). In this case we can just replace
   762    762      * the data associated with the entry, we don't need to manipulate the tree.
   763    763      * 
   764    764      * If there is no exact match, then the cursor points at what would be either
................................................................................
   768    768      * 
   769    769      * The new node is initially red.
   770    770      */
   771    771     memRbtreeMoveto( pCur, pKey, nKey, &match);
   772    772     if( match ){
   773    773       BtRbNode *pNode = sqliteMalloc(sizeof(BtRbNode));
   774    774       pNode->nKey = nKey;
   775         -    pNode->pKey = sqliteMalloc(nKey);
          775  +    pNode->pKey = sqliteMallocRaw(nKey);
   776    776       memcpy(pNode->pKey, pKey, nKey);
   777    777       pNode->nData = nData;
   778    778       pNode->pData = pData; 
   779    779       if( pCur->pNode ){
   780    780         switch( match ){
   781    781           case -1:
   782    782             assert( !pCur->pNode->pRight );
................................................................................
   803    803   
   804    804       /* Set up a rollback-op in case we have to roll this operation back */
   805    805       if( pCur->pRbtree->eTransState != TRANS_ROLLBACK ){
   806    806         BtRollbackOp *pOp = sqliteMalloc( sizeof(BtRollbackOp) );
   807    807         pOp->eOp = ROLLBACK_DELETE;
   808    808         pOp->iTab = pCur->iTree;
   809    809         pOp->nKey = pNode->nKey;
   810         -      pOp->pKey = sqliteMalloc( pOp->nKey );
          810  +      pOp->pKey = sqliteMallocRaw( pOp->nKey );
   811    811         memcpy( pOp->pKey, pNode->pKey, pOp->nKey );
   812    812         btreeLogRollbackOp(pCur->pRbtree, pOp);
   813    813       }
   814    814   
   815    815     }else{ 
   816    816       /* No need to insert a new node in the tree, as the key already exists.
   817    817        * Just clobber the current nodes data. */
   818    818   
   819    819       /* Set up a rollback-op in case we have to roll this operation back */
   820    820       if( pCur->pRbtree->eTransState != TRANS_ROLLBACK ){
   821    821         BtRollbackOp *pOp = sqliteMalloc( sizeof(BtRollbackOp) );
   822    822         pOp->iTab = pCur->iTree;
   823    823         pOp->nKey = pCur->pNode->nKey;
   824         -      pOp->pKey = sqliteMalloc( pOp->nKey );
          824  +      pOp->pKey = sqliteMallocRaw( pOp->nKey );
   825    825         memcpy( pOp->pKey, pCur->pNode->pKey, pOp->nKey );
   826    826         pOp->nData = pCur->pNode->nData;
   827    827         pOp->pData = pCur->pNode->pData;
   828    828         pOp->eOp = ROLLBACK_INSERT;
   829    829         btreeLogRollbackOp(pCur->pRbtree, pOp);
   830    830       }else{
   831    831         sqliteFree( pCur->pNode->pData );
................................................................................
  1024   1024       }
  1025   1025       else {
  1026   1026         BtRbNode *pTmp = pNode->pParent;
  1027   1027         if( tree->eTransState == TRANS_ROLLBACK ){
  1028   1028           sqliteFree( pNode->pKey );
  1029   1029           sqliteFree( pNode->pData );
  1030   1030         }else{
  1031         -        BtRollbackOp *pRollbackOp = sqliteMalloc(sizeof(BtRollbackOp));
         1031  +        BtRollbackOp *pRollbackOp = sqliteMallocRaw(sizeof(BtRollbackOp));
  1032   1032           pRollbackOp->eOp = ROLLBACK_INSERT;
  1033   1033           pRollbackOp->iTab = n;
  1034   1034           pRollbackOp->nKey = pNode->nKey;
  1035   1035           pRollbackOp->pKey = pNode->pKey;
  1036   1036           pRollbackOp->nData = pNode->nData;
  1037   1037           pRollbackOp->pData = pNode->pData;
  1038   1038           btreeLogRollbackOp(tree, pRollbackOp);

Changes to src/util.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Utility functions used throughout sqlite.
    13     13   **
    14     14   ** This file contains functions for allocating memory, comparing
    15     15   ** strings, and stuff like that.
    16     16   **
    17         -** $Id: util.c,v 1.67 2003/08/26 11:29:08 drh Exp $
           17  +** $Id: util.c,v 1.68 2003/10/22 22:15:28 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <stdarg.h>
    21     21   #include <ctype.h>
    22     22   
    23     23   /*
    24     24   ** If malloc() ever fails, this global variable gets set to 1.
................................................................................
   247    247   
   248    248   /*
   249    249   ** Allocate new memory and set it to zero.  Return NULL if
   250    250   ** no memory is available.  See also sqliteMallocRaw().
   251    251   */
   252    252   void *sqliteMalloc(int n){
   253    253     void *p;
   254         -  if( n==0 ) return 0;
   255         -  p = malloc(n);
   256         -  if( p==0 ){
          254  +  if( (p = malloc(n))==0 ){
   257    255       sqlite_malloc_failed++;
   258         -    return 0;
          256  +  }else{
          257  +    memset(p, 0, n);
   259    258     }
   260         -  memset(p, 0, n);
   261    259     return p;
   262    260   }
   263    261   
   264    262   /*
   265    263   ** Allocate new memory but do not set it to zero.  Return NULL if
   266    264   ** no memory is available.  See also sqliteMalloc().
   267    265   */
   268    266   void *sqliteMallocRaw(int n){
   269    267     void *p;
   270         -  if( n==0 ) return 0;
   271         -  p = malloc(n);
   272         -  if( p==0 ){
          268  +  if( (p = malloc(n))==0 ){
   273    269       sqlite_malloc_failed++;
   274         -    return 0;
   275    270     }
   276    271     return p;
   277    272   }
   278    273   
   279    274   /*
   280    275   ** Free memory previously obtained from sqliteMalloc()
   281    276   */

Changes to tool/lempar.c.

    60     60   #define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)
    61     61   
    62     62   /* Next are that tables used to determine what action to take based on the
    63     63   ** current state and lookahead token.  These tables are used to implement
    64     64   ** functions that take a state number and lookahead value and return an
    65     65   ** action integer.  
    66     66   **
    67         -** The action integer is a number N between
    68         -** 0 and YYNSTATE-1 mean shift the look-ahead and go to state N.
    69         -** Numbers between YYNSTATE and YYNSTATE+YYNRULE-1 mean reduce by
    70         -** rule N-YYNSTATE.  Number YYNSTATE+YYNRULE means that a syntax
    71         -** error has occurred.  Number YYNSTATE+YYNRULE+1 means the parser
    72         -** accepts its input.
           67  +** Suppose the action integer is N.  Then the action is determined as
           68  +** follows
    73     69   **
    74         -** The action table is constructed as a single large hash table with
    75         -** a perfect hash.  Given state S and lookahead X, the action is computed
    76         -** as
           70  +**   0 <= N < YYNSTATE                  Shift N.  That is, push the lookahead
           71  +**                                      token onto the stack and goto state N.
           72  +**
           73  +**   YYNSTATE <= N < YYNSTATE+YYNRULE   Reduce by rule N-YYNSTATE.
           74  +**
           75  +**   N == YYNSTATE+YYNRULE              A syntax error has occurred.
           76  +**
           77  +**   N == YYNSTATE+YYNRULE+1            The parser accepts its input.
           78  +**
           79  +**   N == YYNSTATE+YYNRULE+2            No such action.  Denotes unused
           80  +**                                      slots in the yy_action[] table.
           81  +**
           82  +** The action table is constructed as a single large table named yy_action[].
           83  +** Given state S and lookahead X, the action is computed as
    77     84   **
    78     85   **      yy_action[ yy_shift_ofst[S] + X ]
    79     86   **
    80         -** If the index yy_shift_ofst[S]+X is out of range or if the value
           87  +** If the index value yy_shift_ofst[S]+X is out of range or if the value
    81     88   ** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
    82     89   ** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
    83     90   ** and that yy_default[S] should be used instead.  
    84     91   **
    85     92   ** The formula above is for computing the action when the lookahead is
    86     93   ** a terminal symbol.  If the lookahead is a non-terminal (as occurs after
    87     94   ** a reduce action) then the yy_reduce_ofst[] array is used in place of

Changes to www/index.tcl.

     1      1   #
     2      2   # Run this TCL script to generate HTML for the index.html file.
     3      3   #
     4         -set rcsid {$Id: index.tcl,v 1.78 2003/08/22 02:34:30 drh Exp $}
            4  +set rcsid {$Id: index.tcl,v 1.79 2003/10/22 22:15:28 drh Exp $}
     5      5   
     6      6   puts {<html>
     7      7   <head><title>SQLite: An Embeddable SQL Database Engine</title></head>
     8      8   <body bgcolor=white>
     9      9   <h1 align=center>SQLite<br>An Embeddable SQL Database Engine</h1>
    10     10   <p align=center>}
    11     11   puts "This page was last modified on [lrange $rcsid 3 4] UTC<br>"
................................................................................
    66     66       Bindings for many other languages 
    67     67       <a href="http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers">
    68     68       available separately.</a></li>
    69     69   <li>Simple, well-commented source code.</li>
    70     70   <li>Automated test suite provides near 100% code coverage.</li>
    71     71   <li>Self-contained: no external dependencies.</li>
    72     72   <li>Built and tested under Linux and Windows.</li>
    73         -<li>Sources are in the public domain.  Use for any purpose.</li>
           73  +<li>Sources are in the <a href="copyright.html">public domain</a>.
           74  +    Use for any purpose.</li>
    74     75   </ul>
    75     76   </p>
    76     77   }
    77     78   
    78     79   puts {<h2>Current Status</h2>
    79     80   
    80     81   <p>A <a href="changes.html">Change Summary</a> is available on this
................................................................................
   145    146   
   146    147   <p>The SQLite source code is 30% comment.  These comments are
   147    148   another important source of information.  </p>
   148    149   
   149    150   }
   150    151   
   151    152   puts {
   152         -<table align="right">
   153         -<tr><td align="center">
   154         -<a href="http://www.yahoogroups.com/subscribe/sqlite">
   155         -<img src="http://www.egroups.com/img/ui/join.gif" border=0 /><br />
   156         -Click to subscribe to sqlite</a>
   157         -</td></tr>
   158         -</table>
   159    153   <a name="mailinglist" />
   160    154   <h2>Mailing List</h2>
   161         -<p>A mailing list has been set up on yahooGroups for discussion of
   162         -SQLite design issues or for asking questions about SQLite.</p>
          155  +<p>A mailing list has been set up for discussion of
          156  +SQLite design issues or for asking questions about SQLite.
          157  +To subscribe send an email to
          158  +<a href="mailto:sqlite-users-subscribe@sqlite.org">
          159  +sqlite-users-subscribe@sqlite.org</a>.
          160  +If you would prefer to get digests rather than individual
          161  +emails, send a message to to
          162  +<a href="mailto:sqlite-users-digest-subscribe@sqlite.org">
          163  +sqlite-users-digest-subscribe@sqlite.org</a>.
          164  +For additional information about operating and using this
          165  +mailing list, send a message to
          166  +<a href="mailto:sqlite-users-help@sqlite.org">
          167  +sqlite-users-help@sqlite.org</a> and instructions will be
          168  +sent by to you by return email.
          169  +</p>
   163    170   }
   164    171   
   165    172   puts {<h2>Professional Support and Custom Modifications</h2>}
   166    173   
   167    174   puts {
   168    175   <p>
   169    176   If you would like professional support for SQLite