Mercurial > vim
comparison src/spellfile.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 | b52ea9c5f1db |
children | 695d9ef00b03 |
comparison
equal
deleted
inserted
replaced
16763:fccf84413b53 | 16764:ef00b6bc186b |
---|---|
1262 * Inserting backslashes may double the length, "^\(\)$<Nul>" is 7 bytes. | 1262 * Inserting backslashes may double the length, "^\(\)$<Nul>" is 7 bytes. |
1263 * Conversion to utf-8 may double the size. */ | 1263 * Conversion to utf-8 may double the size. */ |
1264 c = todo * 2 + 7; | 1264 c = todo * 2 + 7; |
1265 if (enc_utf8) | 1265 if (enc_utf8) |
1266 c += todo * 2; | 1266 c += todo * 2; |
1267 pat = alloc((unsigned)c); | 1267 pat = alloc(c); |
1268 if (pat == NULL) | 1268 if (pat == NULL) |
1269 return SP_OTHERERROR; | 1269 return SP_OTHERERROR; |
1270 | 1270 |
1271 /* We also need a list of all flags that can appear at the start and one | 1271 /* We also need a list of all flags that can appear at the start and one |
1272 * for all flags. */ | 1272 * for all flags. */ |
6613 int headcl = mb_char2len(headc); | 6613 int headcl = mb_char2len(headc); |
6614 char_u *b; | 6614 char_u *b; |
6615 hash_T hash; | 6615 hash_T hash; |
6616 hashitem_T *hi; | 6616 hashitem_T *hi; |
6617 | 6617 |
6618 b = alloc((unsigned)(cl + headcl + 2)); | 6618 b = alloc(cl + headcl + 2); |
6619 if (b == NULL) | 6619 if (b == NULL) |
6620 return; | 6620 return; |
6621 mb_char2bytes(c, b); | 6621 mb_char2bytes(c, b); |
6622 b[cl] = NUL; | 6622 b[cl] = NUL; |
6623 mb_char2bytes(headc, b + cl + 1); | 6623 mb_char2bytes(headc, b + cl + 1); |