comparison src/vim9compile.c @ 20830:9064044fd4f6 v8.2.0967

patch 8.2.0967: unnecessary type casts for vim_strnsave() Commit: https://github.com/vim/vim/commit/71ccd03ee8a43b20000214a9c99dcc90f039edca Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jun 12 22:59:11 2020 +0200 patch 8.2.0967: unnecessary type casts for vim_strnsave() Problem: Unnecessary type casts for vim_strnsave(). Solution: Remove the type casts.
author Bram Moolenaar <Bram@vim.org>
date Fri, 12 Jun 2020 23:00:04 +0200
parents 9f921ba86d05
children 0600ab7b9f09
comparison
equal deleted inserted replaced
20829:3d0d6410aecd 20830:9064044fd4f6
1573 type_T *type; 1573 type_T *type;
1574 1574
1575 RETURN_OK_IF_SKIP(cctx); 1575 RETURN_OK_IF_SKIP(cctx);
1576 if ((isn = generate_instr(cctx, ISN_STRINGMEMBER)) == NULL) 1576 if ((isn = generate_instr(cctx, ISN_STRINGMEMBER)) == NULL)
1577 return FAIL; 1577 return FAIL;
1578 isn->isn_arg.string = vim_strnsave(name, (int)len); 1578 isn->isn_arg.string = vim_strnsave(name, len);
1579 1579
1580 // check for dict type 1580 // check for dict type
1581 type = ((type_T **)stack->ga_data)[stack->ga_len - 1]; 1581 type = ((type_T **)stack->ga_data)[stack->ga_len - 1];
1582 if (type->tt_type != VAR_DICT && type != &t_any) 1582 if (type->tt_type != VAR_DICT && type != &t_any)
1583 { 1583 {
1669 // the last ones when leaving a scope, but then variables used in a closure 1669 // the last ones when leaving a scope, but then variables used in a closure
1670 // might get overwritten. To keep things simple do not re-use stack 1670 // might get overwritten. To keep things simple do not re-use stack
1671 // entries. This is less efficient, but memory is cheap these days. 1671 // entries. This is less efficient, but memory is cheap these days.
1672 lvar->lv_idx = cctx->ctx_locals_count++; 1672 lvar->lv_idx = cctx->ctx_locals_count++;
1673 1673
1674 lvar->lv_name = vim_strnsave(name, (int)(len == 0 ? STRLEN(name) : len)); 1674 lvar->lv_name = vim_strnsave(name, len == 0 ? STRLEN(name) : len);
1675 lvar->lv_const = isConst; 1675 lvar->lv_const = isConst;
1676 lvar->lv_type = type; 1676 lvar->lv_type = type;
1677 1677
1678 return lvar; 1678 return lvar;
1679 } 1679 }
4625 --var_end; 4625 --var_end;
4626 if (is_decl && p == arg + 2 && p[-1] == ':') 4626 if (is_decl && p == arg + 2 && p[-1] == ':')
4627 --p; 4627 --p;
4628 4628
4629 varlen = p - arg; 4629 varlen = p - arg;
4630 name = vim_strnsave(arg, (int)varlen); 4630 name = vim_strnsave(arg, varlen);
4631 if (name == NULL) 4631 if (name == NULL)
4632 return NULL; 4632 return NULL;
4633 4633
4634 if (cctx->ctx_skip != TRUE) 4634 if (cctx->ctx_skip != TRUE)
4635 { 4635 {
6266 // EXECCONCAT 5 6266 // EXECCONCAT 5
6267 for (;;) 6267 for (;;)
6268 { 6268 {
6269 if (p > start) 6269 if (p > start)
6270 { 6270 {
6271 generate_PUSHS(cctx, vim_strnsave(start, (int)(p - start))); 6271 generate_PUSHS(cctx, vim_strnsave(start, p - start));
6272 ++count; 6272 ++count;
6273 } 6273 }
6274 p += 2; 6274 p += 2;
6275 if (compile_expr0(&p, cctx) == FAIL) 6275 if (compile_expr0(&p, cctx) == FAIL)
6276 return NULL; 6276 return NULL;