Mercurial > vim
comparison src/misc2.c @ 20751:d9a2e5dcfd9f v8.2.0928
patch 8.2.0928: many type casts are used for vim_strnsave()
Commit: https://github.com/vim/vim/commit/df44a27b53586fccfc6a3aedc89061fdd9a515ff
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 7 20:49:05 2020 +0200
patch 8.2.0928: many type casts are used for vim_strnsave()
Problem: Many type casts are used for vim_strnsave().
Solution: Make the length argument size_t instead of int. (Ken Takata,
closes #5633) Remove some type casts.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 07 Jun 2020 21:00:03 +0200 |
parents | 8bce783af0cb |
children | 9328feafbbf5 |
comparison
equal
deleted
inserted
replaced
20750:020a100bfa92 | 20751:d9a2e5dcfd9f |
---|---|
1289 * terminate with a NUL. | 1289 * terminate with a NUL. |
1290 * The allocated memory always has size "len + 1", also when "string" is | 1290 * The allocated memory always has size "len + 1", also when "string" is |
1291 * shorter. | 1291 * shorter. |
1292 */ | 1292 */ |
1293 char_u * | 1293 char_u * |
1294 vim_strnsave(char_u *string, int len) | 1294 vim_strnsave(char_u *string, size_t len) |
1295 { | 1295 { |
1296 char_u *p; | 1296 char_u *p; |
1297 | 1297 |
1298 p = alloc(len + 1); | 1298 p = alloc(len + 1); |
1299 if (p != NULL) | 1299 if (p != NULL) |
1536 /* | 1536 /* |
1537 * Like vim_strnsave(), but make all characters uppercase. | 1537 * Like vim_strnsave(), but make all characters uppercase. |
1538 * This uses ASCII lower-to-upper case translation, language independent. | 1538 * This uses ASCII lower-to-upper case translation, language independent. |
1539 */ | 1539 */ |
1540 char_u * | 1540 char_u * |
1541 vim_strnsave_up(char_u *string, int len) | 1541 vim_strnsave_up(char_u *string, size_t len) |
1542 { | 1542 { |
1543 char_u *p1; | 1543 char_u *p1; |
1544 | 1544 |
1545 p1 = vim_strnsave(string, len); | 1545 p1 = vim_strnsave(string, len); |
1546 vim_strup(p1); | 1546 vim_strup(p1); |