refactor: remove redundant const char * casts

This commit is contained in:
ii14
2023-04-07 19:40:57 +02:00
committed by GitHub
parent 1d2a29f75b
commit 9408f2dcf7
56 changed files with 302 additions and 350 deletions

View File

@@ -185,16 +185,14 @@ static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, char *exp_str
int todo = (int)exp_d->dv_hashtab.ht_used;
for (const hashitem_T *hi = exp_d->dv_hashtab.ht_array; todo > 0; hi++) {
if (!HASHITEM_EMPTY(hi)) {
dictitem_T *item2 = tv_dict_find(got_d, (const char *)hi->hi_key, -1);
dictitem_T *item2 = tv_dict_find(got_d, hi->hi_key, -1);
if (item2 == NULL
|| !tv_equal(&TV_DICT_HI2DI(hi)->di_tv, &item2->di_tv, false, false)) {
// item of exp_d not present in got_d or values differ.
const size_t key_len = strlen(hi->hi_key);
tv_dict_add_tv(exp_tv->vval.v_dict, (const char *)hi->hi_key, key_len,
&TV_DICT_HI2DI(hi)->di_tv);
tv_dict_add_tv(exp_tv->vval.v_dict, hi->hi_key, key_len, &TV_DICT_HI2DI(hi)->di_tv);
if (item2 != NULL) {
tv_dict_add_tv(got_tv->vval.v_dict, (const char *)hi->hi_key, key_len,
&item2->di_tv);
tv_dict_add_tv(got_tv->vval.v_dict, hi->hi_key, key_len, &item2->di_tv);
}
} else {
omitted++;
@@ -207,12 +205,11 @@ static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, char *exp_str
todo = (int)got_d->dv_hashtab.ht_used;
for (const hashitem_T *hi = got_d->dv_hashtab.ht_array; todo > 0; hi++) {
if (!HASHITEM_EMPTY(hi)) {
dictitem_T *item2 = tv_dict_find(exp_d, (const char *)hi->hi_key, -1);
dictitem_T *item2 = tv_dict_find(exp_d, hi->hi_key, -1);
if (item2 == NULL) {
// item of got_d not present in exp_d
const size_t key_len = strlen(hi->hi_key);
tv_dict_add_tv(got_tv->vval.v_dict, (const char *)hi->hi_key, key_len,
&TV_DICT_HI2DI(hi)->di_tv);
tv_dict_add_tv(got_tv->vval.v_dict, hi->hi_key, key_len, &TV_DICT_HI2DI(hi)->di_tv);
}
todo--;
}