/ Check-in [43f757c9]
Login

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

Overview
Comment:Add an extra 'const' qualifier to two arrays (in func.c and pragma.c) to ensure that they do not consume space in the data segment of the compiled object files. (CVS 5663)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:43f757c9f01ccc6e6c7a404fbeb74f825f7a29ca
User & Date: danielk1977 2008-09-02 15:44:09
Context
2008-09-02
16:22
Fine tune the hard-coded values passed to sqlite3_init_wsd(). (CVS 5664) check-in: af5763eb user: danielk1977 tags: trunk
15:44
Add an extra 'const' qualifier to two arrays (in func.c and pragma.c) to ensure that they do not consume space in the data segment of the compiled object files. (CVS 5663) check-in: 43f757c9 user: danielk1977 tags: trunk
14:07
Move the sqlite3SharedCacheEnabled global and the inProgress static variable (function sqlite3_initialize()) into the global sqlite3Config structure. This is required for the OMIT_WSD feature to work on some platforms. (CVS 5662) check-in: 88c82759 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/func.c.

    12     12   ** This file contains the C functions that implement various SQL
    13     13   ** functions of SQLite.  
    14     14   **
    15     15   ** There is only one exported symbol in this file - the function
    16     16   ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
    17     17   ** All other code has file scope.
    18     18   **
    19         -** $Id: func.c,v 1.201 2008/09/01 19:14:02 danielk1977 Exp $
           19  +** $Id: func.c,v 1.202 2008/09/02 15:44:09 danielk1977 Exp $
    20     20   */
    21     21   #include "sqliteInt.h"
    22     22   #include <ctype.h>
    23     23   #include <stdlib.h>
    24     24   #include <assert.h>
    25     25   #include "vdbeInt.h"
    26     26   
................................................................................
   877    877     }
   878    878     zIn = sqlite3_value_text(argv[0]);
   879    879     if( zIn==0 ) return;
   880    880     nIn = sqlite3_value_bytes(argv[0]);
   881    881     assert( zIn==sqlite3_value_text(argv[0]) );
   882    882     if( argc==1 ){
   883    883       static const unsigned char lenOne[] = { 1 };
   884         -    static const unsigned char *azOne[] = { (u8*)" " };
          884  +    static unsigned char * const azOne[] = { (u8*)" " };
   885    885       nChar = 1;
   886    886       aLen = (u8*)lenOne;
   887    887       azChar = (unsigned char **)azOne;
   888    888       zCharSet = 0;
   889    889     }else if( (zCharSet = sqlite3_value_text(argv[1]))==0 ){
   890    890       return;
   891    891     }else{
................................................................................
   933    933       }
   934    934       if( zCharSet ){
   935    935         sqlite3_free(azChar);
   936    936       }
   937    937     }
   938    938     sqlite3_result_text(context, (char*)zIn, nIn, SQLITE_TRANSIENT);
   939    939   }
          940  +
   940    941   
   941    942   #ifdef SQLITE_SOUNDEX
   942    943   /*
   943    944   ** Compute the soundex encoding of a word.
   944    945   */
   945    946   static void soundexFunc(
   946    947     sqlite3_context *context,
................................................................................
  1291   1292     memcpy(aWc, pDef->pUserData, 3);
  1292   1293     assert( (char*)&likeInfoAlt == (char*)&likeInfoAlt.matchAll );
  1293   1294     assert( &((char*)&likeInfoAlt)[1] == (char*)&likeInfoAlt.matchOne );
  1294   1295     assert( &((char*)&likeInfoAlt)[2] == (char*)&likeInfoAlt.matchSet );
  1295   1296     *pIsNocase = (pDef->flags & SQLITE_FUNC_CASE)==0;
  1296   1297     return 1;
  1297   1298   }
  1298         -
  1299   1299   
  1300   1300   /*
  1301   1301   ** All all of the FuncDef structures in the aBuiltinFunc[] array above
  1302   1302   ** to the global function hash table.  This occurs at start-time (as
  1303   1303   ** a consequence of calling sqlite3_initialize()).
  1304   1304   **
  1305   1305   ** After this routine runs

Changes to src/pragma.c.

     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     12   ** This file contains code used to implement the PRAGMA command.
    13     13   **
    14         -** $Id: pragma.c,v 1.185 2008/09/02 00:52:52 drh Exp $
           14  +** $Id: pragma.c,v 1.186 2008/09/02 15:44:09 danielk1977 Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   #include <ctype.h>
    18     18   
    19     19   /* Ignore this whole file if pragmas are disabled
    20     20   */
    21     21   #if !defined(SQLITE_OMIT_PRAGMA) && !defined(SQLITE_OMIT_PARSER)
................................................................................
   445    445   
   446    446     /*
   447    447     **  PRAGMA [database.]journal_mode
   448    448     **  PRAGMA [database.]journal_mode = (delete|persist|off)
   449    449     */
   450    450     if( sqlite3StrICmp(zLeft,"journal_mode")==0 ){
   451    451       int eMode;
   452         -    static const char *azModeName[] = {"delete", "persist", "off"};
          452  +    static char * const azModeName[] = {"delete", "persist", "off"};
   453    453   
   454    454       if( zRight==0 ){
   455    455         eMode = PAGER_JOURNALMODE_QUERY;
   456    456       }else{
   457    457         int n = strlen(zRight);
   458    458         eMode = 2;
   459    459         while( eMode>=0 && sqlite3StrNICmp(zRight, azModeName[eMode], n)!=0 ){
................................................................................
  1188   1188     ** The user-version is not used internally by SQLite. It may be used by
  1189   1189     ** applications for any purpose.
  1190   1190     */
  1191   1191     if( sqlite3StrICmp(zLeft, "schema_version")==0 
  1192   1192      || sqlite3StrICmp(zLeft, "user_version")==0 
  1193   1193      || sqlite3StrICmp(zLeft, "freelist_count")==0 
  1194   1194     ){
  1195         -
  1196   1195       int iCookie;   /* Cookie index. 0 for schema-cookie, 6 for user-cookie. */
  1197   1196       sqlite3VdbeUsesBtree(v, iDb);
  1198   1197       switch( zLeft[0] ){
  1199   1198         case 's': case 'S':
  1200   1199           iCookie = 0;
  1201   1200           break;
  1202   1201         case 'f': case 'F':
................................................................................
  1263   1262         }else if( sqlite3_file_control(db, i ? db->aDb[i].zName : 0, 
  1264   1263                                        SQLITE_FCNTL_LOCKSTATE, &j)==SQLITE_OK ){
  1265   1264            zState = azLockName[j];
  1266   1265         }
  1267   1266         sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, zState, P4_STATIC);
  1268   1267         sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);
  1269   1268       }
         1269  +
  1270   1270     }else
  1271   1271   #endif
  1272   1272   
  1273   1273   #ifdef SQLITE_SSE
  1274   1274     /*
  1275   1275     ** Check to see if the sqlite_statements table exists.  Create it
  1276   1276     ** if it does not.