To: vim_dev@googlegroups.com Subject: Patch 8.1.1393 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1393 Problem: Unnecessary type casts. Solution: Remove type casts from alloc() and lalloc() calls. (Mike Williams) Files: src/channel.c, src/crypt.c, src/dict.c, src/dosinst.c, src/evalfunc.c, src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, src/fileio.c, src/findfile.c, src/if_ole.cpp, src/if_py_both.h, src/list.c, src/message.c, src/misc1.c, src/misc2.c, src/ops.c, src/os_vms.c, src/os_win32.c, src/quickfix.c, src/regexp_nfa.c, src/screen.c, src/search.c, src/sign.c, src/syntax.c, src/tag.c, src/term.c, src/terminal.c, src/textprop.c *** ../vim-8.1.1392/src/channel.c 2019-05-24 19:38:59.096545552 +0200 --- src/channel.c 2019-05-25 20:02:29.156751167 +0200 *************** *** 1354,1360 **** int id) { cbq_T *head = &channel->ch_part[part].ch_cb_head; ! cbq_T *item = (cbq_T *)alloc((int)sizeof(cbq_T)); if (item != NULL) { --- 1354,1360 ---- int id) { cbq_T *head = &channel->ch_part[part].ch_cb_head; ! cbq_T *item = (cbq_T *)alloc(sizeof(cbq_T)); if (item != NULL) { *************** *** 3921,3927 **** } else { ! writeq_T *last = (writeq_T *)alloc((int)sizeof(writeq_T)); if (last != NULL) { --- 3921,3927 ---- } else { ! writeq_T *last = (writeq_T *)alloc(sizeof(writeq_T)); if (last != NULL) { *** ../vim-8.1.1392/src/crypt.c 2019-04-27 22:06:33.348200718 +0200 --- src/crypt.c 2019-05-25 20:02:29.156751167 +0200 *************** *** 254,260 **** char_u *seed, int seed_len) { ! cryptstate_T *state = (cryptstate_T *)alloc((int)sizeof(cryptstate_T)); if (state == NULL) return state; --- 254,260 ---- char_u *seed, int seed_len) { ! cryptstate_T *state = (cryptstate_T *)alloc(sizeof(cryptstate_T)); if (state == NULL) return state; *************** *** 407,413 **** /* Not buffering, just return EOF. */ return (long)len; ! *newptr = alloc((long)len); if (*newptr == NULL) return -1; method->encode_fn(state, from, len, *newptr); --- 407,413 ---- /* Not buffering, just return EOF. */ return (long)len; ! *newptr = alloc(len); if (*newptr == NULL) return -1; method->encode_fn(state, from, len, *newptr); *** ../vim-8.1.1392/src/dict.c 2019-05-24 18:48:36.750128544 +0200 --- src/dict.c 2019-05-25 20:02:29.160751138 +0200 *************** *** 54,60 **** dict_alloc_id(alloc_id_T id UNUSED) { #ifdef FEAT_EVAL ! if (alloc_fail_id == id && alloc_does_fail((long_u)sizeof(list_T))) return NULL; #endif return (dict_alloc()); --- 54,60 ---- dict_alloc_id(alloc_id_T id UNUSED) { #ifdef FEAT_EVAL ! if (alloc_fail_id == id && alloc_does_fail(sizeof(list_T))) return NULL; #endif return (dict_alloc()); *** ../vim-8.1.1392/src/dosinst.c 2019-05-09 15:12:45.168723969 +0200 --- src/dosinst.c 2019-05-25 20:02:29.160751138 +0200 *************** *** 306,312 **** || strchr(cp, '/') != NULL) return; ! tmpname = alloc((int)strlen(cp) + 1); strcpy(tmpname, cp); tmpname[strlen(tmpname) - 1] = 'x'; /* .exe -> .exx */ --- 306,312 ---- || strchr(cp, '/') != NULL) return; ! tmpname = alloc(strlen(cp) + 1); strcpy(tmpname, cp); tmpname[strlen(tmpname) - 1] = 'x'; /* .exe -> .exx */ *************** *** 962,968 **** if (choices[idx].text != NULL) free(choices[idx].text); ! choices[idx].text = alloc((int)(strlen(fmt) + strlen(arg)) - 1); sprintf(choices[idx].text, fmt, arg); } --- 962,968 ---- if (choices[idx].text != NULL) free(choices[idx].text); ! choices[idx].text = alloc(strlen(fmt) + strlen(arg) - 1); sprintf(choices[idx].text, fmt, arg); } *************** *** 1040,1046 **** s = p + strlen(p); if (names != NULL) { ! names[count] = alloc((int)(s - p) + 1); strncpy(names[count], p, s - p); names[count][s - p] = NUL; } --- 1040,1046 ---- s = p + strlen(p); if (names != NULL) { ! names[count] = alloc(s - p + 1); strncpy(names[count], p, s - p); names[count][s - p] = NUL; } *************** *** 1051,1057 **** } if (names != NULL) break; ! names = alloc((int)(count + 1) * sizeof(char *)); } names[0] = alloc(50); sprintf(names[0], "Select directory to create %s in:", name); --- 1051,1057 ---- } if (names != NULL) break; ! names = alloc((count + 1) * sizeof(char *)); } names[0] = alloc(50); sprintf(names[0], "Select directory to create %s in:", name); *** ../vim-8.1.1392/src/evalfunc.c 2019-05-25 19:51:03.776408456 +0200 --- src/evalfunc.c 2019-05-25 20:02:29.160751138 +0200 *************** *** 4412,4418 **** * would also work, but some plugins depend on the name being * printable text. */ sprintf(sid_buf, "%ld_", (long)current_sctx.sc_sid); ! name = alloc((int)(STRLEN(sid_buf) + STRLEN(s + off) + 1)); if (name != NULL) { STRCPY(name, sid_buf); --- 4412,4418 ---- * would also work, but some plugins depend on the name being * printable text. */ sprintf(sid_buf, "%ld_", (long)current_sctx.sc_sid); ! name = alloc(STRLEN(sid_buf) + STRLEN(s + off) + 1); if (name != NULL) { STRCPY(name, sid_buf); *************** *** 12671,12677 **** } /* Make an array with each entry pointing to an item in the List. */ ! ptrs = (sortItem_T *)alloc((int)(len * sizeof(sortItem_T))); if (ptrs == NULL) goto theend; --- 12671,12677 ---- } /* Make an array with each entry pointing to an item in the List. */ ! ptrs = (sortItem_T *)alloc(len * sizeof(sortItem_T)); if (ptrs == NULL) goto theend; *** ../vim-8.1.1392/src/ex_cmds.c 2019-05-24 19:38:59.100545522 +0200 --- src/ex_cmds.c 2019-05-25 20:02:29.160751138 +0200 *************** *** 2746,2752 **** */ ++p; len = getdigits(&p); ! buf = alloc((int)(len + 1)); if (buf == NULL) return TRUE; p = buf; --- 2746,2752 ---- */ ++p; len = getdigits(&p); ! buf = alloc(len + 1); if (buf == NULL) return TRUE; p = buf; *** ../vim-8.1.1392/src/ex_cmds2.c 2019-05-24 18:48:36.754128525 +0200 --- src/ex_cmds2.c 2019-05-25 20:02:29.164751112 +0200 *************** *** 2800,2806 **** oldlen = STRLEN(p_rtp); addlen = STRLEN(fname) + 1; // add one for comma ! new_rtp = alloc((int)(oldlen + addlen + afterlen + 1)); // add one for NUL if (new_rtp == NULL) goto theend; --- 2800,2806 ---- oldlen = STRLEN(p_rtp); addlen = STRLEN(fname) + 1; // add one for comma ! new_rtp = alloc(oldlen + addlen + afterlen + 1); // add one for NUL if (new_rtp == NULL) goto theend; *** ../vim-8.1.1392/src/ex_docmd.c 2019-05-25 20:10:32.837684661 +0200 --- src/ex_docmd.c 2019-05-25 20:08:37.058383759 +0200 *************** *** 4816,4822 **** while ((pos = (char_u *)strstr((char *)pos + 2, "$*")) != NULL) ++i; len = (int)STRLEN(p); ! new_cmdline = alloc((int)(STRLEN(program) + i * (len - 2) + 1)); if (new_cmdline == NULL) return NULL; /* out of memory */ ptr = new_cmdline; --- 4816,4822 ---- while ((pos = (char_u *)strstr((char *)pos + 2, "$*")) != NULL) ++i; len = (int)STRLEN(p); ! new_cmdline = alloc(STRLEN(program) + i * (len - 2) + 1); if (new_cmdline == NULL) return NULL; /* out of memory */ ptr = new_cmdline; *************** *** 4832,4838 **** } else { ! new_cmdline = alloc((int)(STRLEN(program) + STRLEN(p) + 2)); if (new_cmdline == NULL) return NULL; /* out of memory */ STRCPY(new_cmdline, program); --- 4832,4838 ---- } else { ! new_cmdline = alloc(STRLEN(program) + STRLEN(p) + 2); if (new_cmdline == NULL) return NULL; /* out of memory */ STRCPY(new_cmdline, program); *** ../vim-8.1.1392/src/ex_getln.c 2019-05-24 19:38:59.100545522 +0200 --- src/ex_getln.c 2019-05-25 20:02:29.164751112 +0200 *************** *** 5914,5921 **** { if (newlen) { ! temp = (histentry_T *)alloc( ! (long_u)(newlen * sizeof(histentry_T))); if (temp == NULL) /* out of memory! */ { if (type == 0) /* first one: just keep the old length */ --- 5914,5920 ---- { if (newlen) { ! temp = (histentry_T *)alloc(newlen * sizeof(histentry_T)); if (temp == NULL) /* out of memory! */ { if (type == 0) /* first one: just keep the old length */ *************** *** 6655,6661 **** viminfo_history[type] = NULL; else viminfo_history[type] = (histentry_T *)lalloc( ! (long_u)(len * sizeof(histentry_T)), FALSE); if (viminfo_history[type] == NULL) len = 0; viminfo_hislen[type] = len; --- 6654,6660 ---- viminfo_history[type] = NULL; else viminfo_history[type] = (histentry_T *)lalloc( ! len * sizeof(histentry_T), FALSE); if (viminfo_history[type] == NULL) len = 0; viminfo_hislen[type] = len; *** ../vim-8.1.1392/src/fileio.c 2019-05-24 19:38:59.100545522 +0200 --- src/fileio.c 2019-05-25 20:02:29.164751112 +0200 *************** *** 7190,7196 **** ga_init2(gap, (int)sizeof(char *), 20); #ifdef MSWIN ! buf = alloc((int)MAXPATHL); if (buf == NULL) return FAIL; STRNCPY(buf, path, MAXPATHL-5); --- 7190,7196 ---- ga_init2(gap, (int)sizeof(char *), 20); #ifdef MSWIN ! buf = alloc(MAXPATHL); if (buf == NULL) return FAIL; STRNCPY(buf, path, MAXPATHL-5); *** ../vim-8.1.1392/src/findfile.c 2019-05-24 18:48:36.758128504 +0200 --- src/findfile.c 2019-05-25 20:02:29.164751112 +0200 *************** *** 588,596 **** if (search_ctx->ffsc_wc_path != NULL) { wc_path = vim_strsave(search_ctx->ffsc_wc_path); ! temp = alloc((int)(STRLEN(search_ctx->ffsc_wc_path) + STRLEN(search_ctx->ffsc_fix_path + len) ! + 1)); if (temp == NULL || wc_path == NULL) { vim_free(buf); --- 588,596 ---- if (search_ctx->ffsc_wc_path != NULL) { wc_path = vim_strsave(search_ctx->ffsc_wc_path); ! temp = alloc(STRLEN(search_ctx->ffsc_wc_path) + STRLEN(search_ctx->ffsc_fix_path + len) ! + 1); if (temp == NULL || wc_path == NULL) { vim_free(buf); *************** *** 722,728 **** * filepath is used as buffer for various actions and as the storage to * return a found filename. */ ! if ((file_path = alloc((int)MAXPATHL)) == NULL) return NULL; #ifdef FEAT_PATH_EXTRA --- 722,728 ---- * filepath is used as buffer for various actions and as the storage to * return a found filename. */ ! if ((file_path = alloc(MAXPATHL)) == NULL) return NULL; #ifdef FEAT_PATH_EXTRA *************** *** 1866,1872 **** break; } ! if ((buf = alloc((int)(MAXPATHL))) == NULL) break; // copy next path --- 1866,1872 ---- break; } ! if ((buf = alloc(MAXPATHL)) == NULL) break; // copy next path *************** *** 2274,2280 **** char_u *p; int len; ! if ((buf = alloc((int)MAXPATHL)) == NULL) return; while (*path_option != NUL) --- 2274,2280 ---- char_u *p; int len; ! if ((buf = alloc(MAXPATHL)) == NULL) return; while (*path_option != NUL) *************** *** 2424,2430 **** if (regmatch.regprog == NULL) return; ! if ((curdir = alloc((int)(MAXPATHL))) == NULL) goto theend; mch_dirname(curdir, MAXPATHL); expand_path_option(curdir, &path_ga); --- 2424,2430 ---- if (regmatch.regprog == NULL) return; ! if ((curdir = alloc(MAXPATHL)) == NULL) goto theend; mch_dirname(curdir, MAXPATHL); expand_path_option(curdir, &path_ga); *************** *** 2532,2538 **** continue; } ! rel_path = alloc((int)(STRLEN(short_name) + STRLEN(PATHSEPSTR) + 2)); if (rel_path == NULL) goto theend; STRCPY(rel_path, "."); --- 2532,2538 ---- continue; } ! rel_path = alloc(STRLEN(short_name) + STRLEN(PATHSEPSTR) + 2); if (rel_path == NULL) goto theend; STRCPY(rel_path, "."); *** ../vim-8.1.1392/src/if_ole.cpp 2019-05-09 15:12:45.168723969 +0200 --- src/if_ole.cpp 2019-05-25 20:02:29.164751112 +0200 *************** *** 376,382 **** if (len == 0) return E_INVALIDARG; ! buffer = (char *)alloc((unsigned)len); if (buffer == NULL) return E_OUTOFMEMORY; --- 376,382 ---- if (len == 0) return E_INVALIDARG; ! buffer = (char *)alloc(len); if (buffer == NULL) return E_OUTOFMEMORY; *** ../vim-8.1.1392/src/if_py_both.h 2019-05-20 21:52:42.794911591 +0200 --- src/if_py_both.h 2019-05-25 20:02:29.164751112 +0200 *************** *** 2953,2959 **** char_u *np; size_t len = STRLEN(p) + 1; ! if ((np = alloc((int)len + 2)) == NULL) { vim_free(p); return NULL; --- 2953,2959 ---- char_u *np; size_t len = STRLEN(p) + 1; ! if ((np = alloc(len + 2)) == NULL) { vim_free(p); return NULL; *************** *** 3139,3145 **** if (exported) { pt->pt_argv = (typval_T *)alloc_clear( ! sizeof(typval_T) * self->argc); for (i = 0; i < pt->pt_argc; ++i) copy_tv(&self->argv[i], &pt->pt_argv[i]); } --- 3139,3145 ---- if (exported) { pt->pt_argv = (typval_T *)alloc_clear( ! sizeof(typval_T) * self->argc); for (i = 0; i < pt->pt_argc; ++i) copy_tv(&self->argv[i], &pt->pt_argv[i]); } *************** *** 4262,4268 **** /* Create a copy of the string, with internal nulls replaced by * newline characters, as is the vim convention. */ ! save = (char *)alloc((unsigned)(len+1)); if (save == NULL) { PyErr_NoMemory(); --- 4262,4268 ---- /* Create a copy of the string, with internal nulls replaced by * newline characters, as is the vim convention. */ ! save = (char *)alloc(len+1); if (save == NULL) { PyErr_NoMemory(); *** ../vim-8.1.1392/src/list.c 2019-01-13 23:38:33.399773248 +0100 --- src/list.c 2019-05-25 20:02:29.164751112 +0200 *************** *** 92,98 **** list_alloc_id(alloc_id_T id UNUSED) { #ifdef FEAT_EVAL ! if (alloc_fail_id == id && alloc_does_fail((long_u)sizeof(list_T))) return NULL; #endif return (list_alloc()); --- 92,98 ---- list_alloc_id(alloc_id_T id UNUSED) { #ifdef FEAT_EVAL ! if (alloc_fail_id == id && alloc_does_fail(sizeof(list_T))) return NULL; #endif return (list_alloc()); *************** *** 122,128 **** rettv_list_alloc_id(typval_T *rettv, alloc_id_T id UNUSED) { #ifdef FEAT_EVAL ! if (alloc_fail_id == id && alloc_does_fail((long_u)sizeof(list_T))) return FAIL; #endif return rettv_list_alloc(rettv); --- 122,128 ---- rettv_list_alloc_id(typval_T *rettv, alloc_id_T id UNUSED) { #ifdef FEAT_EVAL ! if (alloc_fail_id == id && alloc_does_fail(sizeof(list_T))) return FAIL; #endif return rettv_list_alloc(rettv); *** ../vim-8.1.1392/src/message.c 2019-05-24 18:48:36.766128461 +0200 --- src/message.c 2019-05-25 20:02:29.168751083 +0200 *************** *** 875,881 **** (void)delete_first_msg(); /* allocate an entry and add the message at the end of the history */ ! p = (struct msg_hist *)alloc((int)sizeof(struct msg_hist)); if (p != NULL) { if (len < 0) --- 875,881 ---- (void)delete_first_msg(); /* allocate an entry and add the message at the end of the history */ ! p = (struct msg_hist *)alloc(sizeof(struct msg_hist)); if (p != NULL) { if (len < 0) *************** *** 2360,2366 **** if (s > *sb_str) { ! mp = (msgchunk_T *)alloc((int)(sizeof(msgchunk_T) + (s - *sb_str))); if (mp != NULL) { mp->sb_eol = finish; --- 2360,2366 ---- if (s > *sb_str) { ! mp = (msgchunk_T *)alloc(sizeof(msgchunk_T) + (s - *sb_str)); if (mp != NULL) { mp->sb_eol = finish; *** ../vim-8.1.1392/src/misc1.c 2019-05-24 18:48:36.766128461 +0200 --- src/misc1.c 2019-05-25 20:02:29.168751083 +0200 *************** *** 3446,3452 **** // Make room for file name. When doing encoding conversion the actual // length may be quite a bit longer, thus use the maximum possible length. ! buf = alloc((int)MAXPATHL); if (buf == NULL) return 0; --- 3446,3452 ---- // Make room for file name. When doing encoding conversion the actual // length may be quite a bit longer, thus use the maximum possible length. ! buf = alloc(MAXPATHL); if (buf == NULL) return 0; *************** *** 3690,3696 **** } /* make room for file name */ ! buf = alloc((int)STRLEN(path) + BASENAMELEN + 5); if (buf == NULL) return 0; --- 3690,3696 ---- } /* make room for file name */ ! buf = alloc(STRLEN(path) + BASENAMELEN + 5); if (buf == NULL) return 0; *** ../vim-8.1.1392/src/misc2.c 2019-05-24 18:48:36.746128566 +0200 --- src/misc2.c 2019-05-25 20:02:29.168751083 +0200 *************** *** 1290,1296 **** { char_u *p; ! p = alloc((size_t)(len + 1)); if (p != NULL) { STRNCPY(p, string, len); --- 1290,1296 ---- { char_u *p; ! p = alloc(len + 1); if (p != NULL) { STRNCPY(p, string, len); *** ../vim-8.1.1392/src/ops.c 2019-05-24 19:38:59.104545491 +0200 --- src/ops.c 2019-05-25 20:02:29.168751083 +0200 *************** *** 3355,3361 **** free_yank_all(); *y_current = *curr; y_current->y_array = (char_u **)lalloc_clear( ! (long_u)(sizeof(char_u *) * y_current->y_size), TRUE); if (y_current->y_array == NULL) y_current->y_size = 0; else --- 3355,3361 ---- free_yank_all(); *y_current = *curr; y_current->y_array = (char_u **)lalloc_clear( ! sizeof(char_u *) * y_current->y_size, TRUE); if (y_current->y_array == NULL) y_current->y_size = 0; else *** ../vim-8.1.1392/src/os_vms.c 2019-05-24 18:48:36.770128440 +0200 --- src/os_vms.c 2019-05-25 20:02:29.168751083 +0200 *************** *** 245,251 **** else if ((sbuf = getenv((char *)lognam))) { lengte = strlen(sbuf) + 1; ! cp = (char_u *)alloc((size_t)lengte); if (cp) strcpy((char *)cp, sbuf); return cp; --- 245,251 ---- else if ((sbuf = getenv((char *)lognam))) { lengte = strlen(sbuf) + 1; ! cp = (char_u *)alloc(lengte); if (cp) strcpy((char *)cp, sbuf); return cp; *** ../vim-8.1.1392/src/os_win32.c 2019-05-24 19:38:59.108545464 +0200 --- src/os_win32.c 2019-05-25 20:02:29.168751083 +0200 *************** *** 7117,7123 **** return; /* Remember the buffer numbers for the arguments. */ ! fnum_list = (int *)alloc((int)sizeof(int) * GARGCOUNT); if (fnum_list == NULL) return; /* out of memory */ for (i = 0; i < GARGCOUNT; ++i) --- 7117,7123 ---- return; /* Remember the buffer numbers for the arguments. */ ! fnum_list = (int *)alloc(sizeof(int) * GARGCOUNT); if (fnum_list == NULL) return; /* out of memory */ for (i = 0; i < GARGCOUNT; ++i) *** ../vim-8.1.1392/src/quickfix.c 2019-05-24 19:38:59.108545464 +0200 --- src/quickfix.c 2019-05-25 20:02:29.168751083 +0200 *************** *** 1815,1821 **** if (title != NULL) { ! char_u *p = alloc((int)STRLEN(title) + 2); qfl->qf_title = p; if (p != NULL) --- 1815,1821 ---- if (title != NULL) { ! char_u *p = alloc(STRLEN(title) + 2); qfl->qf_title = p; if (p != NULL) *** ../vim-8.1.1392/src/regexp_nfa.c 2019-05-24 19:38:59.108545464 +0200 --- src/regexp_nfa.c 2019-05-25 20:02:29.168751083 +0200 *************** *** 4799,4805 **** emsg(_(e_maxmempat)); return NULL; } ! newl = (nfa_thread_T *)alloc((int)newsize); if (newl == NULL) return NULL; l->len = newlen; --- 4799,4805 ---- emsg(_(e_maxmempat)); return NULL; } ! newl = (nfa_thread_T *)alloc(newsize); if (newl == NULL) return NULL; l->len = newlen; *** ../vim-8.1.1392/src/screen.c 2019-05-25 19:51:03.780408437 +0200 --- src/screen.c 2019-05-25 20:02:29.172751058 +0200 *************** *** 328,357 **** /* Allocate space to save the text displayed in the command line area. */ rows = screen_Rows - cmdline_row; ! screenline = (schar_T *)lalloc( ! (long_u)(rows * cols * sizeof(schar_T)), FALSE); ! screenattr = (sattr_T *)lalloc( ! (long_u)(rows * cols * sizeof(sattr_T)), FALSE); if (screenline == NULL || screenattr == NULL) ret = 2; if (enc_utf8) { screenlineUC = (u8char_T *)lalloc( ! (long_u)(rows * cols * sizeof(u8char_T)), FALSE); if (screenlineUC == NULL) ret = 2; for (i = 0; i < p_mco; ++i) { screenlineC[i] = (u8char_T *)lalloc( ! (long_u)(rows * cols * sizeof(u8char_T)), FALSE); if (screenlineC[i] == NULL) ret = 2; } } if (enc_dbcs == DBCS_JPNU) { ! screenline2 = (schar_T *)lalloc( ! (long_u)(rows * cols * sizeof(schar_T)), FALSE); if (screenline2 == NULL) ret = 2; } --- 328,354 ---- /* Allocate space to save the text displayed in the command line area. */ rows = screen_Rows - cmdline_row; ! screenline = (schar_T *)lalloc(rows * cols * sizeof(schar_T), FALSE); ! screenattr = (sattr_T *)lalloc(rows * cols * sizeof(sattr_T), FALSE); if (screenline == NULL || screenattr == NULL) ret = 2; if (enc_utf8) { screenlineUC = (u8char_T *)lalloc( ! rows * cols * sizeof(u8char_T), FALSE); if (screenlineUC == NULL) ret = 2; for (i = 0; i < p_mco; ++i) { screenlineC[i] = (u8char_T *)lalloc( ! rows * cols * sizeof(u8char_T), FALSE); if (screenlineC[i] == NULL) ret = 2; } } if (enc_dbcs == DBCS_JPNU) { ! screenline2 = (schar_T *)lalloc(rows * cols * sizeof(schar_T), FALSE); if (screenline2 == NULL) ret = 2; } *** ../vim-8.1.1392/src/search.c 2019-05-24 22:08:11.366273819 +0200 --- src/search.c 2019-05-25 20:02:29.172751058 +0200 *************** *** 1429,1435 **** // Reserve enough space for the search pattern + offset. len = STRLEN(p) + off_len + 3; ! msgbuf = alloc((int)len); if (msgbuf != NULL) { vim_memset(msgbuf, ' ', len); --- 1429,1435 ---- // Reserve enough space for the search pattern + offset. len = STRLEN(p) + off_len + 3; ! msgbuf = alloc(len); if (msgbuf != NULL) { vim_memset(msgbuf, ' ', len); *** ../vim-8.1.1392/src/sign.c 2019-05-24 19:38:59.112545434 +0200 --- src/sign.c 2019-05-25 20:02:29.172751058 +0200 *************** *** 85,92 **** if (HASHITEM_EMPTY(hi)) { // new group ! group = (signgroup_T *)alloc( ! (unsigned)(sizeof(signgroup_T) + STRLEN(groupname))); if (group == NULL) return NULL; STRCPY(group->sg_name, groupname); --- 85,91 ---- if (HASHITEM_EMPTY(hi)) { // new group ! group = (signgroup_T *)alloc(sizeof(signgroup_T) + STRLEN(groupname)); if (group == NULL) return NULL; STRCPY(group->sg_name, groupname); *************** *** 737,744 **** int start = next_sign_typenr; // Allocate a new sign. ! sp = (sign_T *)alloc_clear_id((unsigned)sizeof(sign_T), ! aid_sign_define_by_name); if (sp == NULL) return NULL; --- 736,742 ---- int start = next_sign_typenr; // Allocate a new sign. ! sp = (sign_T *)alloc_clear_id(sizeof(sign_T), aid_sign_define_by_name); if (sp == NULL) return NULL; *** ../vim-8.1.1392/src/syntax.c 2019-05-24 19:38:59.112545434 +0200 --- src/syntax.c 2019-05-25 20:02:29.172751058 +0200 *************** *** 4494,4500 **** name_folded, MAXKEYWLEN + 1); else name_ic = name; ! kp = (keyentry_T *)alloc((int)(sizeof(keyentry_T) + STRLEN(name_ic))); if (kp == NULL) return; STRCPY(kp->keyword, name_ic); --- 4494,4500 ---- name_folded, MAXKEYWLEN + 1); else name_ic = name; ! kp = (keyentry_T *)alloc(sizeof(keyentry_T) + STRLEN(name_ic)); if (kp == NULL) return; STRCPY(kp->keyword, name_ic); *************** *** 6001,6007 **** { for (end = p; *end && !VIM_ISWHITE(*end) && *end != ','; ++end) ; ! name = alloc((int)(end - p + 3)); /* leave room for "^$" */ if (name == NULL) { failed = TRUE; --- 6001,6007 ---- { for (end = p; *end && !VIM_ISWHITE(*end) && *end != ','; ++end) ; ! name = alloc(end - p + 3); /* leave room for "^$" */ if (name == NULL) { failed = TRUE; *** ../vim-8.1.1392/src/tag.c 2019-05-24 19:38:59.112545434 +0200 --- src/tag.c 2019-05-25 20:02:29.172751058 +0200 *************** *** 1430,1436 **** if (name_only) mfp = vim_strsave(res_name); else ! mfp = (char_u *)alloc((int)sizeof(char_u) + len + 1); if (mfp == NULL) continue; --- 1430,1436 ---- if (name_only) mfp = vim_strsave(res_name); else ! mfp = (char_u *)alloc(sizeof(char_u) + len + 1); if (mfp == NULL) continue; *************** *** 2536,2542 **** */ *tagp.tagname_end = NUL; len = (int)(tagp.tagname_end - tagp.tagname); ! mfp = (char_u *)alloc((int)sizeof(char_u) + len + 10 + ML_EXTRA + 1); if (mfp != NULL) { --- 2536,2542 ---- */ *tagp.tagname_end = NUL; len = (int)(tagp.tagname_end - tagp.tagname); ! mfp = (char_u *)alloc(sizeof(char_u) + len + 10 + ML_EXTRA + 1); if (mfp != NULL) { *************** *** 2585,2591 **** else { len = (int)(tagp.tagname_end - tagp.tagname); ! mfp = (char_u *)alloc((int)sizeof(char_u) + len + 1); if (mfp != NULL) vim_strncpy(mfp, tagp.tagname, len); --- 2585,2591 ---- else { len = (int)(tagp.tagname_end - tagp.tagname); ! mfp = (char_u *)alloc(sizeof(char_u) + len + 1); if (mfp != NULL) vim_strncpy(mfp, tagp.tagname, len); *************** *** 2620,2626 **** else ++len; #endif ! mfp = (char_u *)alloc((int)sizeof(char_u) + len + 1); if (mfp != NULL) { p = mfp; --- 2620,2626 ---- else ++len; #endif ! mfp = (char_u *)alloc(sizeof(char_u) + len + 1); if (mfp != NULL) { p = mfp; *************** *** 3346,3352 **** /* Make a copy of the line, it can become invalid when an autocommand calls * back here recursively. */ len = matching_line_len(lbuf_arg) + 1; ! lbuf = alloc((int)len); if (lbuf != NULL) mch_memmove(lbuf, lbuf_arg, len); --- 3346,3352 ---- /* Make a copy of the line, it can become invalid when an autocommand calls * back here recursively. */ len = matching_line_len(lbuf_arg) + 1; ! lbuf = alloc(len); if (lbuf != NULL) mch_memmove(lbuf, lbuf_arg, len); *** ../vim-8.1.1392/src/term.c 2019-05-24 18:48:36.774128421 +0200 --- src/term.c 2019-05-25 20:02:29.172751058 +0200 *************** *** 4188,4194 **** { tc_max_len += 20; new_tc = (struct termcode *)alloc( ! (unsigned)(tc_max_len * sizeof(struct termcode))); if (new_tc == NULL) { tc_max_len -= 20; --- 4188,4194 ---- { tc_max_len += 20; new_tc = (struct termcode *)alloc( ! tc_max_len * sizeof(struct termcode)); if (new_tc == NULL) { tc_max_len -= 20; *************** *** 7072,7078 **** if (!counting) { colornames_table = (struct rgbcolor_table_S *)alloc( ! (unsigned)(sizeof(struct rgbcolor_table_S) * size)); if (colornames_table == NULL) { fclose(fd); --- 7072,7078 ---- if (!counting) { colornames_table = (struct rgbcolor_table_S *)alloc( ! sizeof(struct rgbcolor_table_S) * size); if (colornames_table == NULL) { fclose(fd); *** ../vim-8.1.1392/src/terminal.c 2019-05-25 19:51:03.780408437 +0200 --- src/terminal.c 2019-05-25 20:02:29.172751058 +0200 *************** *** 534,540 **** cmd = (char_u*)""; len = STRLEN(cmd) + 10; ! p = alloc((int)len); for (i = 0; p != NULL; ++i) { --- 534,540 ---- cmd = (char_u*)""; len = STRLEN(cmd) + 10; ! p = alloc(len); for (i = 0; p != NULL; ++i) { *************** *** 1630,1636 **** if (len == 0) p = NULL; else ! p = (cellattr_T *)alloc((int)sizeof(cellattr_T) * len); if ((p != NULL || len == 0) && ga_grow(&term->tl_scrollback, 1) == OK) { --- 1630,1636 ---- if (len == 0) p = NULL; else ! p = (cellattr_T *)alloc(sizeof(cellattr_T) * len); if ((p != NULL || len == 0) && ga_grow(&term->tl_scrollback, 1) == OK) { *************** *** 2884,2890 **** ga_init2(&ga, 1, 100); if (len > 0) ! p = (cellattr_T *)alloc((int)sizeof(cellattr_T) * len); if (p != NULL) { for (col = 0; col < len; col += cells[col].width) --- 2884,2890 ---- ga_init2(&ga, 1, 100); if (len > 0) ! p = (cellattr_T *)alloc(sizeof(cellattr_T) * len); if (p != NULL) { for (col = 0; col < len; col += cells[col].width) *************** *** 3718,3724 **** p = dict_get_string(dict, (char_u *)"encoding", FALSE); if (p != NULL) { ! ea.cmd = alloc((int)STRLEN(p) + 12); if (ea.cmd != NULL) { sprintf((char *)ea.cmd, "sbuf ++enc=%s", p); --- 3718,3724 ---- p = dict_get_string(dict, (char_u *)"encoding", FALSE); if (p != NULL) { ! ea.cmd = alloc(STRLEN(p) + 12); if (ea.cmd != NULL) { sprintf((char *)ea.cmd, "sbuf ++enc=%s", p); *************** *** 4031,4037 **** else txt = (char_u *)_("finished"); len = 9 + STRLEN(term->tl_buffer->b_fname) + STRLEN(txt); ! term->tl_status_text = alloc((int)len); if (term->tl_status_text != NULL) vim_snprintf((char *)term->tl_status_text, len, "%s [%s]", term->tl_buffer->b_fname, txt); --- 4031,4037 ---- else txt = (char_u *)_("finished"); len = 9 + STRLEN(term->tl_buffer->b_fname) + STRLEN(txt); ! term->tl_status_text = alloc(len); if (term->tl_status_text != NULL) vim_snprintf((char *)term->tl_status_text, len, "%s [%s]", term->tl_buffer->b_fname, txt); *************** *** 4663,4669 **** { size_t len = STRLEN(fname1) + 12; ! fname_tofree = alloc((int)len); if (fname_tofree != NULL) { vim_snprintf((char *)fname_tofree, len, "dump diff %s", fname1); --- 4663,4669 ---- { size_t len = STRLEN(fname1) + 12; ! fname_tofree = alloc(len); if (fname_tofree != NULL) { vim_snprintf((char *)fname_tofree, len, "dump diff %s", fname1); *************** *** 4935,4941 **** else { size_t size = sizeof(sb_line_T) * term->tl_scrollback.ga_len; ! sb_line_T *temp = (sb_line_T *)alloc((int)size); /* need to copy cell properties into temp memory */ if (temp != NULL) --- 4935,4941 ---- else { size_t size = sizeof(sb_line_T) * term->tl_scrollback.ga_len; ! sb_line_T *temp = (sb_line_T *)alloc(size); /* need to copy cell properties into temp memory */ if (temp != NULL) *************** *** 5800,5806 **** { /* Request by CreateProcessW */ breq = wcslen(cmd_wchar) + 1 + 1; /* Addition of NUL by API */ ! cmd_wchar_copy = (PWSTR)alloc((int)(breq * sizeof(WCHAR))); wcsncpy(cmd_wchar_copy, cmd_wchar, breq - 1); } --- 5800,5806 ---- { /* Request by CreateProcessW */ breq = wcslen(cmd_wchar) + 1 + 1; /* Addition of NUL by API */ ! cmd_wchar_copy = (PWSTR)alloc(breq * sizeof(WCHAR)); wcsncpy(cmd_wchar_copy, cmd_wchar, breq - 1); } *************** *** 5830,5836 **** /* Set up pipe inheritance safely: Vista or later. */ pInitializeProcThreadAttributeList(NULL, 1, 0, &breq); term->tl_siex.lpAttributeList = ! (PPROC_THREAD_ATTRIBUTE_LIST)alloc((int)breq); if (!term->tl_siex.lpAttributeList) goto failed; if (!pInitializeProcThreadAttributeList(term->tl_siex.lpAttributeList, 1, --- 5830,5836 ---- /* Set up pipe inheritance safely: Vista or later. */ pInitializeProcThreadAttributeList(NULL, 1, 0, &breq); term->tl_siex.lpAttributeList = ! (PPROC_THREAD_ATTRIBUTE_LIST)alloc(breq); if (!term->tl_siex.lpAttributeList) goto failed; if (!pInitializeProcThreadAttributeList(term->tl_siex.lpAttributeList, 1, *** ../vim-8.1.1392/src/textprop.c 2019-05-24 21:22:25.672809688 +0200 --- src/textprop.c 2019-05-25 20:02:29.176751028 +0200 *************** *** 1220,1226 **** oldproplen = get_text_props(curbuf, lnum, &props, FALSE); len = STRLEN(newp) + 1; ! line = alloc((int)(len + (oldproplen + proplen) * sizeof(textprop_T))); if (line == NULL) return; mch_memmove(line, newp, len); --- 1220,1226 ---- oldproplen = get_text_props(curbuf, lnum, &props, FALSE); len = STRLEN(newp) + 1; ! line = alloc(len + (oldproplen + proplen) * sizeof(textprop_T)); if (line == NULL) return; mch_memmove(line, newp, len); *** ../vim-8.1.1392/src/version.c 2019-05-25 20:10:32.841684636 +0200 --- src/version.c 2019-05-25 20:20:40.270198657 +0200 *************** *** 769,770 **** --- 769,772 ---- { /* Add new patch number below this line */ + /**/ + 1393, /**/ -- The History of every major Galactic Civilization tends to pass through three distinct and recognizable phases, those of Survival, Inquiry and Sophistication, otherwise known as the How, Why and Where phases. For instance, the first phase is characterized by the question 'How can we eat?' the second by the question 'Why do we eat?' and the third by the question 'Where shall we have lunch?' -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///