Mercurial > vim
comparison src/getchar.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 | fbab59a5ee6b |
children | 695d9ef00b03 |
comparison
equal
deleted
inserted
replaced
16763:fccf84413b53 | 16764:ef00b6bc186b |
---|---|
3729 goto theend; | 3729 goto theend; |
3730 | 3730 |
3731 /* | 3731 /* |
3732 * Get here when adding a new entry to the maphash[] list or abbrlist. | 3732 * Get here when adding a new entry to the maphash[] list or abbrlist. |
3733 */ | 3733 */ |
3734 mp = (mapblock_T *)alloc((unsigned)sizeof(mapblock_T)); | 3734 mp = (mapblock_T *)alloc(sizeof(mapblock_T)); |
3735 if (mp == NULL) | 3735 if (mp == NULL) |
3736 { | 3736 { |
3737 retval = 4; /* no mem */ | 3737 retval = 4; /* no mem */ |
3738 goto theend; | 3738 goto theend; |
3739 } | 3739 } |
4373 if (count == 0) /* no match found */ | 4373 if (count == 0) /* no match found */ |
4374 break; /* for (round) */ | 4374 break; /* for (round) */ |
4375 | 4375 |
4376 if (round == 1) | 4376 if (round == 1) |
4377 { | 4377 { |
4378 *file = (char_u **)alloc((unsigned)(count * sizeof(char_u *))); | 4378 *file = (char_u **)alloc(count * sizeof(char_u *)); |
4379 if (*file == NULL) | 4379 if (*file == NULL) |
4380 return FAIL; | 4380 return FAIL; |
4381 } | 4381 } |
4382 } /* for (round) */ | 4382 } /* for (round) */ |
4383 | 4383 |
4693 char_u *s, *d; | 4693 char_u *s, *d; |
4694 | 4694 |
4695 /* Need a buffer to hold up to three times as much. Four in case of an | 4695 /* Need a buffer to hold up to three times as much. Four in case of an |
4696 * illegal utf-8 byte: | 4696 * illegal utf-8 byte: |
4697 * 0xc0 -> 0xc3 0x80 -> 0xc3 K_SPECIAL KS_SPECIAL KE_FILLER */ | 4697 * 0xc0 -> 0xc3 0x80 -> 0xc3 K_SPECIAL KS_SPECIAL KE_FILLER */ |
4698 res = alloc((unsigned)(STRLEN(p) * 4) + 1); | 4698 res = alloc(STRLEN(p) * 4 + 1); |
4699 if (res != NULL) | 4699 if (res != NULL) |
4700 { | 4700 { |
4701 d = res; | 4701 d = res; |
4702 for (s = p; *s != NUL; ) | 4702 for (s = p; *s != NUL; ) |
4703 { | 4703 { |