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 / 6.2.250 < prev    next >
Encoding:
Internet Message Format  |  2004-02-09  |  3.4 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.2.250
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.2.250
  11. Problem:    Memory leaks when using signs. (Xavier de Gaye)
  12. Solution:   Delete the list of signs when unloading a buffer.
  13. Files:        src/buffer.c
  14.  
  15.  
  16. *** ../vim-6.2.249/src/buffer.c    Sun Jan 18 20:58:01 2004
  17. --- src/buffer.c    Tue Feb 10 15:50:40 2004
  18. ***************
  19. *** 55,60 ****
  20. --- 55,65 ----
  21.   # define dev_T unsigned
  22.   #endif
  23.   
  24. + #if defined(FEAT_SIGNS)
  25. + static void insert_sign __ARGS((buf_T *buf, signlist_T *prev, signlist_T *next, int id, linenr_T lnum, int typenr));
  26. + static void buf_delete_signs __ARGS((buf_T *buf));
  27. + #endif
  28.   /*
  29.    * Open current buffer, that is: open the memfile and read the file into memory
  30.    * return FAIL for failure, OK otherwise
  31. ***************
  32. *** 559,564 ****
  33. --- 564,572 ----
  34.   #ifdef FEAT_SYN_HL
  35.       syntax_clear(buf);            /* reset syntax info */
  36.   #endif
  37. + #ifdef FEAT_SIGNS
  38. +     buf_delete_signs(buf);        /* delete any signs */
  39. + #endif
  40.   }
  41.   
  42.   /*
  43. ***************
  44. *** 4557,4565 ****
  45.   
  46.   
  47.   #if defined(FEAT_SIGNS) || defined(PROTO)
  48. - static void insert_sign __ARGS((buf_T *buf, signlist_T *prev, signlist_T *next, int id, linenr_T lnum, int typenr));
  49.   /*
  50.    * Insert the sign into the signlist.
  51.    */
  52. --- 4565,4570 ----
  53. ***************
  54. *** 4822,4845 ****
  55.   # endif /* FEAT_NETBEANS_INTG */
  56.   
  57.   
  58.       void
  59.   buf_delete_all_signs()
  60.   {
  61.       buf_T    *buf;        /* buffer we are checking for signs */
  62. -     signlist_T    *sign;        /* a sign in a b_signlist */
  63. -     signlist_T    *next;        /* the next sign in a b_signlist */
  64.   
  65.       for (buf = firstbuf; buf != NULL; buf = buf->b_next)
  66.       if (buf->b_signlist != NULL)
  67.       {
  68.           /* Need to redraw the windows to remove the sign column. */
  69.           redraw_buf_later(buf, NOT_VALID);
  70. !         for (sign = buf->b_signlist; sign != NULL; sign = next)
  71. !         {
  72. !         next = sign->next;
  73. !         vim_free(sign);
  74. !         }
  75. !         buf->b_signlist = NULL;
  76.       }
  77.   }
  78.   
  79. --- 4827,4863 ----
  80.   # endif /* FEAT_NETBEANS_INTG */
  81.   
  82.   
  83. + /*
  84. +  * Delete signs in buffer "buf".
  85. +  */
  86. +     static void
  87. + buf_delete_signs(buf)
  88. +     buf_T    *buf;
  89. + {
  90. +     signlist_T    *next;
  91. +     while (buf->b_signlist != NULL)
  92. +     {
  93. +     next = buf->b_signlist->next;
  94. +     vim_free(buf->b_signlist);
  95. +     buf->b_signlist = next;
  96. +     }
  97. + }
  98. + /*
  99. +  * Delete all signs in all buffers.
  100. +  */
  101.       void
  102.   buf_delete_all_signs()
  103.   {
  104.       buf_T    *buf;        /* buffer we are checking for signs */
  105.   
  106.       for (buf = firstbuf; buf != NULL; buf = buf->b_next)
  107.       if (buf->b_signlist != NULL)
  108.       {
  109.           /* Need to redraw the windows to remove the sign column. */
  110.           redraw_buf_later(buf, NOT_VALID);
  111. !         buf_delete_signs(buf);
  112.       }
  113.   }
  114.   
  115. *** ../vim-6.2.249/src/version.c    Tue Feb 10 19:35:15 2004
  116. --- src/version.c    Tue Feb 10 19:36:41 2004
  117. ***************
  118. *** 639,640 ****
  119. --- 639,642 ----
  120.   {   /* Add new patch number below this line */
  121. + /**/
  122. +     250,
  123.   /**/
  124.  
  125. -- 
  126. I AM THANKFUL...
  127. ...for the mess to clean after a party because it means I have
  128. been surrounded by friends.
  129.  
  130.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  131. ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  132. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  133.  \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///
  134.