Diff
Not logged in

Differences From:

File src/subscript.c part of check-in [2a707334c9] - Fix some compiler warnings. Comment changes on non-functioning code in tkt.c. by drh on 2007-11-22 01:53:24. [view]

To:

File src/subscript.c part of check-in [34af72801d] - New default header and footer and CSS. Add the ability to edit the footer. by drh on 2007-11-23 22:09:47. [view]

@@ -113,9 +113,9 @@
 struct SbsHashEntry {
   SbsHashEntry *pNext;     /* Next entry with the same hash on zKey */
   SbSValue val;            /* The payload */
   int nKey;               /* Length of the key */
-  char zKey[0];           /* The key */
+  char zKey[1];           /* The key */
 };
 
 /*
 ** A hash table is an instance of the following structure.
@@ -384,18 +384,20 @@
 int SbS_Store(
   struct Subscript *p,   /* Store into this interpreter */
   const char *zName,     /* Name of the variable */
   const char *zValue,    /* Value of the variable */
-  int makeCopy           /* If true, interpreter makes its own copy */
+  int persistence        /* 0: static.  1: ephemeral.  2: dynamic */
 ){
   SbSValue v;
   v.flags = SBSVAL_STR;
   v.u.str.size = strlen(zValue);
-  if( makeCopy ){
-    v.u.str.z = mprintf("%s", zValue);
-    v.flags |= SBSVAL_DYN;
+  if( persistence==1 ){
+    v.u.str.z = mprintf("%s", zValue);
   }else{
     v.u.str.z = (char*)zValue;
+  }
+  if( persistence>0 ){
+    v.flags |= SBSVAL_DYN;
   }
   return sbs_store(&p->symTab, zName, -1, &v);
 }