Mercurial > vim
comparison src/menu.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 | 822d00007b34 |
children | 695d9ef00b03 |
comparison
equal
deleted
inserted
replaced
16763:fccf84413b53 | 16764:ef00b6bc186b |
---|---|
692 /* | 692 /* |
693 * The pointers next_name & path_name refer to a string with | 693 * The pointers next_name & path_name refer to a string with |
694 * \'s and ^V's stripped out. But menu_path is a "raw" | 694 * \'s and ^V's stripped out. But menu_path is a "raw" |
695 * string, so we must correct for special characters. | 695 * string, so we must correct for special characters. |
696 */ | 696 */ |
697 tearpath = alloc((unsigned int)STRLEN(menu_path) + TEAR_LEN + 2); | 697 tearpath = alloc(STRLEN(menu_path) + TEAR_LEN + 2); |
698 if (tearpath != NULL) | 698 if (tearpath != NULL) |
699 { | 699 { |
700 char_u *s; | 700 char_u *s; |
701 int idx; | 701 int idx; |
702 | 702 |
778 } | 778 } |
779 } | 779 } |
780 | 780 |
781 if (c != 0) | 781 if (c != 0) |
782 { | 782 { |
783 menu->strings[i] = alloc((unsigned)(STRLEN(call_data) + 5 )); | 783 menu->strings[i] = alloc(STRLEN(call_data) + 5); |
784 if (menu->strings[i] != NULL) | 784 if (menu->strings[i] != NULL) |
785 { | 785 { |
786 menu->strings[i][0] = c; | 786 menu->strings[i][0] = c; |
787 if (d == 0) | 787 if (d == 0) |
788 STRCPY(menu->strings[i] + 1, call_data); | 788 STRCPY(menu->strings[i] + 1, call_data); |
1314 expand_modes = MENU_ALL_MODES; | 1314 expand_modes = MENU_ALL_MODES; |
1315 | 1315 |
1316 menu = root_menu; | 1316 menu = root_menu; |
1317 if (after_dot != arg) | 1317 if (after_dot != arg) |
1318 { | 1318 { |
1319 path_name = alloc((unsigned)(after_dot - arg)); | 1319 path_name = alloc(after_dot - arg); |
1320 if (path_name == NULL) | 1320 if (path_name == NULL) |
1321 return NULL; | 1321 return NULL; |
1322 vim_strncpy(path_name, arg, after_dot - arg - 1); | 1322 vim_strncpy(path_name, arg, after_dot - arg - 1); |
1323 } | 1323 } |
1324 name = path_name; | 1324 name = path_name; |