home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.2 / 7.2.423 < prev    next >
Encoding:
Internet Message Format  |  2010-05-13  |  4.4 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.2.423
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.2.423
  11. Problem:    Crash when assigning s: to variable. (Yukihiro Nakadaira)
  12. Solution:   Make ga_scripts contain pointer to scriptvar_T instead of
  13.         scriptvar_T itself. (Dominique Pelle)
  14. Files:        src/eval.c
  15.  
  16.  
  17. *** ../vim-7.2.422/src/eval.c    2010-03-17 19:53:44.000000000 +0100
  18. --- src/eval.c    2010-05-14 12:02:16.000000000 +0200
  19. ***************
  20. *** 145,153 ****
  21.       dict_T    sv_dict;
  22.   } scriptvar_T;
  23.   
  24. ! static garray_T        ga_scripts = {0, 0, sizeof(scriptvar_T), 4, NULL};
  25. ! #define SCRIPT_SV(id) (((scriptvar_T *)ga_scripts.ga_data)[(id) - 1])
  26. ! #define SCRIPT_VARS(id) (SCRIPT_SV(id).sv_dict.dv_hashtab)
  27.   
  28.   static int echo_attr = 0;   /* attributes used for ":echo" */
  29.   
  30. --- 145,153 ----
  31.       dict_T    sv_dict;
  32.   } scriptvar_T;
  33.   
  34. ! static garray_T        ga_scripts = {0, 0, sizeof(scriptvar_T *), 4, NULL};
  35. ! #define SCRIPT_SV(id) (((scriptvar_T **)ga_scripts.ga_data)[(id) - 1])
  36. ! #define SCRIPT_VARS(id) (SCRIPT_SV(id)->sv_dict.dv_hashtab)
  37.   
  38.   static int echo_attr = 0;   /* attributes used for ":echo" */
  39.   
  40. ***************
  41. *** 866,875 ****
  42.       hash_init(&vimvarht);  /* garbage_collect() will access it */
  43.       hash_clear(&compat_hashtab);
  44.   
  45. -     /* script-local variables */
  46. -     for (i = 1; i <= ga_scripts.ga_len; ++i)
  47. -     vars_clear(&SCRIPT_VARS(i));
  48. -     ga_clear(&ga_scripts);
  49.       free_scriptnames();
  50.   
  51.       /* global variables */
  52. --- 866,871 ----
  53. ***************
  54. *** 878,883 ****
  55. --- 874,887 ----
  56.       /* autoloaded script names */
  57.       ga_clear_strings(&ga_loaded);
  58.   
  59. +     /* script-local variables */
  60. +     for (i = 1; i <= ga_scripts.ga_len; ++i)
  61. +     {
  62. +     vars_clear(&SCRIPT_VARS(i));
  63. +     vim_free(SCRIPT_SV(i));
  64. +     }
  65. +     ga_clear(&ga_scripts);
  66.       /* unreferenced lists and dicts */
  67.       (void)garbage_collect();
  68.   
  69. ***************
  70. *** 18803,18809 ****
  71.       /* Must be something like "s:", otherwise "ht" would be NULL. */
  72.       switch (varname[-2])
  73.       {
  74. !         case 's': return &SCRIPT_SV(current_SID).sv_var;
  75.           case 'g': return &globvars_var;
  76.           case 'v': return &vimvars_var;
  77.           case 'b': return &curbuf->b_bufvar;
  78. --- 18807,18813 ----
  79.       /* Must be something like "s:", otherwise "ht" would be NULL. */
  80.       switch (varname[-2])
  81.       {
  82. !         case 's': return &SCRIPT_SV(current_SID)->sv_var;
  83.           case 'g': return &globvars_var;
  84.           case 'v': return &vimvars_var;
  85.           case 'b': return &curbuf->b_bufvar;
  86. ***************
  87. *** 18928,18940 ****
  88.           ht = &SCRIPT_VARS(i);
  89.           if (ht->ht_mask == HT_INIT_SIZE - 1)
  90.           ht->ht_array = ht->ht_smallarray;
  91. !         sv = &SCRIPT_SV(i);
  92.           sv->sv_var.di_tv.vval.v_dict = &sv->sv_dict;
  93.       }
  94.   
  95.       while (ga_scripts.ga_len < id)
  96.       {
  97. !         sv = &SCRIPT_SV(ga_scripts.ga_len + 1);
  98.           init_var_dict(&sv->sv_dict, &sv->sv_var);
  99.           ++ga_scripts.ga_len;
  100.       }
  101. --- 18932,18945 ----
  102.           ht = &SCRIPT_VARS(i);
  103.           if (ht->ht_mask == HT_INIT_SIZE - 1)
  104.           ht->ht_array = ht->ht_smallarray;
  105. !         sv = SCRIPT_SV(i);
  106.           sv->sv_var.di_tv.vval.v_dict = &sv->sv_dict;
  107.       }
  108.   
  109.       while (ga_scripts.ga_len < id)
  110.       {
  111. !         sv = SCRIPT_SV(ga_scripts.ga_len + 1) = 
  112. !         (scriptvar_T *)alloc_clear(sizeof(scriptvar_T));
  113.           init_var_dict(&sv->sv_dict, &sv->sv_var);
  114.           ++ga_scripts.ga_len;
  115.       }
  116. ***************
  117. *** 21931,21937 ****
  118.       if (find_viminfo_parameter('!') == NULL)
  119.       return;
  120.   
  121. !     fprintf(fp, _("\n# global variables:\n"));
  122.   
  123.       todo = (int)globvarht.ht_used;
  124.       for (hi = globvarht.ht_array; todo > 0; ++hi)
  125. --- 21936,21942 ----
  126.       if (find_viminfo_parameter('!') == NULL)
  127.       return;
  128.   
  129. !     fputs(_("\n# global variables:\n"), fp);
  130.   
  131.       todo = (int)globvarht.ht_used;
  132.       for (hi = globvarht.ht_array; todo > 0; ++hi)
  133. *** ../vim-7.2.422/src/version.c    2010-05-13 17:46:53.000000000 +0200
  134. --- src/version.c    2010-05-14 12:13:19.000000000 +0200
  135. ***************
  136. *** 683,684 ****
  137. --- 683,686 ----
  138.   {   /* Add new patch number below this line */
  139. + /**/
  140. +     423,
  141.   /**/
  142.  
  143. -- 
  144. He who laughs last, thinks slowest.
  145.  
  146.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  147. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  148. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  149.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  150.