comparison src/fold.c @ 16764:ef00b6bc186b v8.1.1384

patch 8.1.1384: using "int" for alloc() often results in compiler warnings commit https://github.com/vim/vim/commit/964b3746b9c81e65887e2ac9a335f181db2bb592 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 24 18:54:09 2019 +0200 patch 8.1.1384: using "int" for alloc() often results in compiler warnings Problem: Using "int" for alloc() often results in compiler warnings. Solution: Use "size_t" and remove type casts. Remove alloc_check(), Vim only works with 32 bit ints anyway.
author Bram Moolenaar <Bram@vim.org>
date Fri, 24 May 2019 19:00:07 +0200
parents 1ec942f1b648
children 92e0996e1cb8
comparison
equal deleted inserted replaced
16763:fccf84413b53 16764:ef00b6bc186b
1768 { 1768 {
1769 #if defined(FEAT_COMMENTS) 1769 #if defined(FEAT_COMMENTS)
1770 /* Check if the line ends with an unclosed comment */ 1770 /* Check if the line ends with an unclosed comment */
1771 (void)skip_comment(line, FALSE, FALSE, &line_is_comment); 1771 (void)skip_comment(line, FALSE, FALSE, &line_is_comment);
1772 #endif 1772 #endif
1773 newline = alloc((unsigned)(line_len + markerlen + STRLEN(cms) + 1)); 1773 newline = alloc(line_len + markerlen + STRLEN(cms) + 1);
1774 if (newline == NULL) 1774 if (newline == NULL)
1775 return; 1775 return;
1776 STRCPY(newline, line); 1776 STRCPY(newline, line);
1777 /* Append the marker to the end of the line */ 1777 /* Append the marker to the end of the line */
1778 if (p == NULL || line_is_comment) 1778 if (p == NULL || line_is_comment)
1847 } 1847 }
1848 } 1848 }
1849 if (u_save(lnum - 1, lnum + 1) == OK) 1849 if (u_save(lnum - 1, lnum + 1) == OK)
1850 { 1850 {
1851 /* Make new line: text-before-marker + text-after-marker */ 1851 /* Make new line: text-before-marker + text-after-marker */
1852 newline = alloc((unsigned)(STRLEN(line) - len + 1)); 1852 newline = alloc(STRLEN(line) - len + 1);
1853 if (newline != NULL) 1853 if (newline != NULL)
1854 { 1854 {
1855 STRNCPY(newline, line, p - line); 1855 STRNCPY(newline, line, p - line);
1856 STRCPY(newline + (p - line), p + len); 1856 STRCPY(newline + (p - line), p + len);
1857 ml_replace(lnum, newline, FALSE); 1857 ml_replace(lnum, newline, FALSE);