To: vim-dev@vim.org Subject: Patch 6.1.114 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.114 Problem: ":python import vim", ":python vim.current.buffer[0:0] = []" gives a lalloc(0) error. (Chris Southern) Solution: Don't allocate an array when it's size is zero. Files: src/if_python.c *** ../vim61.113/src/if_python.c Fri Jan 11 09:53:29 2002 --- src/if_python.c Fri Jun 28 19:08:25 2002 *************** *** 2305,2315 **** char **array; buf_T *savebuf; ! array = (char **)alloc((unsigned)(new_len * sizeof(char *))); ! if (array == NULL) { ! PyErr_NoMemory(); ! return FAIL; } for (i = 0; i < new_len; ++i) --- 2305,2320 ---- char **array; buf_T *savebuf; ! if (new_len == 0) /* avoid allocating zero bytes */ ! array = NULL; ! else { ! array = (char **)alloc((unsigned)(new_len * sizeof(char *))); ! if (array == NULL) ! { ! PyErr_NoMemory(); ! return FAIL; ! } } for (i = 0; i < new_len; ++i) *** ../vim61.113/src/version.c Thu Jun 27 21:27:57 2002 --- src/version.c Fri Jun 28 19:11:15 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 114, /**/ -- WOMAN: King of the who? ARTHUR: The Britons. WOMAN: Who are the Britons? ARTHUR: Well, we all are. we're all Britons and I am your king. The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///