Patch 9.0.1037
Problem:    lalloc(0) error for a class without members.
Solution:   Don't allocate room for members if there aren't any.
            Don't create the class if there was an error.
Files:      src/vim9class.c


*** ../vim-9.0.1036/src/vim9class.c     2022-12-08 20:41:55.433288306 +0000
--- src/vim9class.c     2022-12-08 22:07:24.899674120 +0000
***************
*** 121,128 ****
                semsg(_(e_command_cannot_be_shortened_str), line);
            else if (*p == '|' || !ends_excmd2(line, p))
                semsg(_(e_trailing_characters_str), p);
! 
!           success = TRUE;
            break;
        }
  
--- 121,128 ----
                semsg(_(e_command_cannot_be_shortened_str), line);
            else if (*p == '|' || !ends_excmd2(line, p))
                semsg(_(e_trailing_characters_str), p);
!           else
!               success = TRUE;
            break;
        }
  
***************
*** 190,198 ****
  
        // Members are used by the new() function, add them here.
        cl->class_obj_member_count = objmembers.ga_len;
!       cl->class_obj_members = ALLOC_MULT(objmember_T, objmembers.ga_len);
        if (cl->class_name == NULL
!               || cl->class_obj_members == NULL)
        {
            vim_free(cl->class_name);
            vim_free(cl->class_obj_members);
--- 190,199 ----
  
        // Members are used by the new() function, add them here.
        cl->class_obj_member_count = objmembers.ga_len;
!       cl->class_obj_members = objmembers.ga_len == 0 ? NULL
!                                 : ALLOC_MULT(objmember_T, objmembers.ga_len);
        if (cl->class_name == NULL
!               || (objmembers.ga_len > 0 && cl->class_obj_members == NULL))
        {
            vim_free(cl->class_name);
            vim_free(cl->class_obj_members);
*** ../vim-9.0.1036/src/version.c       2022-12-08 21:49:09.844530541 +0000
--- src/version.c       2022-12-08 22:02:43.803796791 +0000
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1037,
  /**/

-- 
God made the integers; all else is the work of Man.
                -- Kronecker

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20221208221005.5C81D1C1742%40moolenaar.net.

Raspunde prin e-mail lui