diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-24 19:39:03 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-24 19:39:03 +0200 |
commit | 18a4ba29aeccb9841d5bfdd2eaaffdfae2f15ced (patch) | |
tree | 408ad339f6b34876d2fa481ac61568c7739b1160 /src | |
parent | 71de720c2c117137185a6fc233b35aab37f0d4bc (diff) |
patch 8.1.1386: unessesary type casts for lalloc()v8.1.1386
Problem: Unessesary type casts for lalloc().
Solution: Remove type casts. Change lalloc(size, TRUE) to alloc(size).
Diffstat (limited to 'src')
41 files changed, 127 insertions, 138 deletions
diff --git a/src/buffer.c b/src/buffer.c index d99071674f..f6210952d6 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1958,7 +1958,7 @@ buflist_new( } if (buf != curbuf || curbuf == NULL) { - buf = (buf_T *)alloc_clear((unsigned)sizeof(buf_T)); + buf = (buf_T *)alloc_clear(sizeof(buf_T)); if (buf == NULL) { vim_free(ffname); @@ -1985,7 +1985,7 @@ buflist_new( } clear_wininfo(buf); - buf->b_wininfo = (wininfo_T *)alloc_clear((unsigned)sizeof(wininfo_T)); + buf->b_wininfo = (wininfo_T *)alloc_clear(sizeof(wininfo_T)); if ((ffname != NULL && (buf->b_ffname == NULL || buf->b_sfname == NULL)) || buf->b_wininfo == NULL) @@ -2771,7 +2771,7 @@ buflist_setfpos( if (wip == NULL) { /* allocate a new entry */ - wip = (wininfo_T *)alloc_clear((unsigned)sizeof(wininfo_T)); + wip = (wininfo_T *)alloc_clear(sizeof(wininfo_T)); if (wip == NULL) return; wip->wi_win = win; @@ -4911,7 +4911,7 @@ do_arg_all( setpcmark(); opened_len = ARGCOUNT; - opened = alloc_clear((unsigned)opened_len); + opened = alloc_clear(opened_len); if (opened == NULL) return; diff --git a/src/change.c b/src/change.c index d2aa1530f1..8f0cacb450 100644 --- a/src/change.c +++ b/src/change.c @@ -282,7 +282,7 @@ f_listener_add(typval_T *argvars, typval_T *rettv) return; } - lnr = (listener_T *)alloc_clear((sizeof(listener_T))); + lnr = (listener_T *)alloc_clear(sizeof(listener_T)); if (lnr == NULL) { free_callback(callback, partial); diff --git a/src/channel.c b/src/channel.c index 1564128efb..4794ae3fab 100644 --- a/src/channel.c +++ b/src/channel.c @@ -294,7 +294,7 @@ static int next_ch_id = 0; add_channel(void) { ch_part_T part; - channel_T *channel = (channel_T *)alloc_clear((int)sizeof(channel_T)); + channel_T *channel = (channel_T *)alloc_clear(sizeof(channel_T)); if (channel == NULL) return NULL; @@ -1728,7 +1728,7 @@ channel_get_all(channel_T *channel, ch_part_T part, int *outlen) // Concatenate everything into one buffer. for (node = head->rq_next; node != NULL; node = node->rq_next) len += node->rq_buflen; - res = lalloc(len + 1, TRUE); + res = alloc(len + 1); if (res == NULL) return NULL; p = res; diff --git a/src/diff.c b/src/diff.c index 3c72e12bf8..7210ce2680 100644 --- a/src/diff.c +++ b/src/diff.c @@ -710,7 +710,7 @@ diff_write_buffer(buf_T *buf, diffin_T *din) // xdiff requires one big block of memory with all the text. for (lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum) len += (long)STRLEN(ml_get_buf(buf, lnum, FALSE)) + 1; - ptr = lalloc(len, TRUE); + ptr = alloc(len); if (ptr == NULL) { // Allocating memory failed. This can happen, because we try to read diff --git a/src/edit.c b/src/edit.c index 6e2fdb8448..6e4b4743c4 100644 --- a/src/edit.c +++ b/src/edit.c @@ -3859,7 +3859,7 @@ replace_push( if (replace_stack_len <= replace_stack_nr) { replace_stack_len += 50; - p = lalloc(sizeof(char_u) * replace_stack_len, TRUE); + p = alloc(sizeof(char_u) * replace_stack_len); if (p == NULL) /* out of memory */ { replace_stack_len -= 50; diff --git a/src/eval.c b/src/eval.c index 4796a25bb3..1d5d0f11a9 100644 --- a/src/eval.c +++ b/src/eval.c @@ -491,7 +491,7 @@ var_redir_start(char_u *name, int append) if (redir_varname == NULL) return FAIL; - redir_lval = (lval_T *)alloc_clear((unsigned)sizeof(lval_T)); + redir_lval = (lval_T *)alloc_clear(sizeof(lval_T)); if (redir_lval == NULL) { var_redir_stop(); @@ -7288,7 +7288,7 @@ handle_subscript( typval_T * alloc_tv(void) { - return (typval_T *)alloc_clear((unsigned)sizeof(typval_T)); + return (typval_T *)alloc_clear(sizeof(typval_T)); } /* diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 7420d6752a..3d967580bc 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -397,7 +397,7 @@ ex_sort(exarg_T *eap) sortbuf1 = NULL; sortbuf2 = NULL; regmatch.regprog = NULL; - nrs = (sorti_T *)lalloc((long_u)(count * sizeof(sorti_T)), TRUE); + nrs = (sorti_T *)alloc(count * sizeof(sorti_T)); if (nrs == NULL) goto sortend; @@ -793,8 +793,7 @@ ex_retab(exarg_T *eap) /* len is actual number of white characters used */ len = num_spaces + num_tabs; old_len = (long)STRLEN(ptr); - new_line = lalloc(old_len - col + start_col + len + 1, - TRUE); + new_line = alloc(old_len - col + start_col + len + 1); if (new_line == NULL) break; if (start_col > 0) @@ -1745,7 +1744,7 @@ make_filter_cmd( len += (long_u)STRLEN(itmp) + 9; /* " { < " + " } " */ if (otmp != NULL) len += (long_u)STRLEN(otmp) + (long_u)STRLEN(p_srr) + 2; /* " " */ - buf = lalloc(len, TRUE); + buf = alloc(len); if (buf == NULL) return NULL; @@ -2536,7 +2535,7 @@ viminfo_readstring( if (virp->vir_line[off] == Ctrl_V && vim_isdigit(virp->vir_line[off + 1])) { len = atol((char *)virp->vir_line + off + 1); - retval = lalloc(len, TRUE); + retval = alloc(len); if (retval == NULL) { /* Line too long? File messed up? Skip next line. */ diff --git a/src/ex_getln.c b/src/ex_getln.c index 00193fee88..530efce579 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -4166,7 +4166,7 @@ ExpandOne( len = 0; for (i = 0; i < xp->xp_numfiles; ++i) len += (long_u)STRLEN(xp->xp_files[i]) + 1; - ss = lalloc(len, TRUE); + ss = alloc(len); if (ss != NULL) { *ss = NUL; @@ -5914,8 +5914,8 @@ init_history(void) { if (newlen) { - temp = (histentry_T *)lalloc( - (long_u)(newlen * sizeof(histentry_T)), TRUE); + 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 */ @@ -6688,7 +6688,7 @@ read_viminfo_history(vir_T *virp, int writing) { /* Need to re-allocate to append the separator byte. */ len = STRLEN(val); - p = lalloc(len + 2, TRUE); + p = alloc(len + 2); if (p != NULL) { if (type == HIST_SEARCH) @@ -6774,7 +6774,7 @@ handle_viminfo_history( { /* Need to re-allocate to append the separator byte. */ len = vp[3].bv_len; - p = lalloc(len + 2, TRUE); + p = alloc(len + 2); } else len = 0; /* for picky compilers */ diff --git a/src/fileio.c b/src/fileio.c index 4182d563fd..96207ab9ca 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -89,7 +89,7 @@ struct bw_info int bw_restlen; /* nr of bytes in bw_rest[] */ int bw_first; /* first write call */ char_u *bw_conv_buf; /* buffer for writing converted chars */ - int bw_conv_buflen; /* size of bw_conv_buf */ + size_t bw_conv_buflen; /* size of bw_conv_buf */ int bw_conv_error; /* set for conversion error */ linenr_T bw_conv_error_lnum; /* first line with error or zero */ linenr_T bw_start_lnum; /* line number at start of buffer */ @@ -1189,7 +1189,7 @@ retry: { for ( ; size >= 10; size = (long)((long_u)size >> 1)) { - if ((new_buffer = lalloc((long_u)(size + linerest + 1), + if ((new_buffer = lalloc(size + linerest + 1, FALSE)) != NULL) break; } @@ -4168,8 +4168,7 @@ buf_write( write_info.bw_conv_buflen = bufsize * 2; else /* FIO_UCS4 */ write_info.bw_conv_buflen = bufsize * 4; - write_info.bw_conv_buf - = lalloc((long_u)write_info.bw_conv_buflen, TRUE); + write_info.bw_conv_buf = alloc(write_info.bw_conv_buflen); if (write_info.bw_conv_buf == NULL) end = 0; } @@ -4180,8 +4179,7 @@ buf_write( { /* Convert UTF-8 -> UCS-2 and UCS-2 -> DBCS. Worst-case * 4: */ write_info.bw_conv_buflen = bufsize * 4; - write_info.bw_conv_buf - = lalloc((long_u)write_info.bw_conv_buflen, TRUE); + write_info.bw_conv_buf = alloc(write_info.bw_conv_buflen); if (write_info.bw_conv_buf == NULL) end = 0; } @@ -4191,8 +4189,7 @@ buf_write( if (converted && wb_flags == 0 && (wb_flags = get_mac_fio_flags(fenc)) != 0) { write_info.bw_conv_buflen = bufsize * 3; - write_info.bw_conv_buf - = lalloc((long_u)write_info.bw_conv_buflen, TRUE); + write_info.bw_conv_buf = alloc(write_info.bw_conv_buflen); if (write_info.bw_conv_buf == NULL) end = 0; } @@ -4212,8 +4209,7 @@ buf_write( { /* We're going to use iconv(), allocate a buffer to convert in. */ write_info.bw_conv_buflen = bufsize * ICONV_MULT; - write_info.bw_conv_buf - = lalloc((long_u)write_info.bw_conv_buflen, TRUE); + write_info.bw_conv_buf = alloc(write_info.bw_conv_buflen); if (write_info.bw_conv_buf == NULL) end = 0; write_info.bw_first = TRUE; diff --git a/src/getchar.c b/src/getchar.c index 0ebe715cd4..9eacdc9a96 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -156,7 +156,7 @@ get_buffcont( for (bp = buffer->bh_first.b_next; bp != NULL; bp = bp->b_next) count += (long_u)STRLEN(bp->b_str); - if ((count || dozero) && (p = lalloc(count + 1, TRUE)) != NULL) + if ((count || dozero) && (p = alloc(count + 1)) != NULL) { p2 = p; for (bp = buffer->bh_first.b_next; bp != NULL; bp = bp->b_next) @@ -258,8 +258,7 @@ add_buff( len = MINIMAL_SIZE; else len = slen; - p = (buffblock_T *)lalloc((long_u)(sizeof(buffblock_T) + len), - TRUE); + p = (buffblock_T *)alloc(sizeof(buffblock_T) + len); if (p == NULL) return; /* no space, just forget it */ buf->bh_space = (int)(len - slen); diff --git a/src/gui_mac.c b/src/gui_mac.c index c177ee650b..41fb01ec3f 100644 --- a/src/gui_mac.c +++ b/src/gui_mac.c @@ -4476,7 +4476,7 @@ clip_mch_request_selection(VimClipboard *cbd) /* In CARBON we don't need a Handle, a pointer is good */ textOfClip = NewHandle(scrapSize); - /* tempclip = lalloc(scrapSize+1, TRUE); */ + /* tempclip = alloc(scrapSize+1); */ HLock(textOfClip); error = GetScrapFlavorData(scrap, flavor ? VIMSCRAPFLAVOR : SCRAPTEXTFLAVOR, @@ -4488,7 +4488,7 @@ clip_mch_request_selection(VimClipboard *cbd) else type = MAUTO; - tempclip = lalloc(scrapSize + 1, TRUE); + tempclip = alloc(scrapSize + 1); mch_memmove(tempclip, *textOfClip + flavor, scrapSize); tempclip[scrapSize] = 0; diff --git a/src/gui_w32.c b/src/gui_w32.c index bf27386061..fd46b66856 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -6803,12 +6803,12 @@ gui_mch_dialog( dfltbutton = -1; /* Allocate array to hold the width of each button */ - buttonWidths = (int *)lalloc(numButtons * sizeof(int), TRUE); + buttonWidths = (int *)alloc(numButtons * sizeof(int)); if (buttonWidths == NULL) return -1; /* Allocate array to hold the X position of each button */ - buttonPositions = (int *)lalloc(numButtons * sizeof(int), TRUE); + buttonPositions = (int *)alloc(numButtons * sizeof(int)); if (buttonPositions == NULL) return -1; diff --git a/src/gui_x11.c b/src/gui_x11.c index 6ff1644173..01881380bc 100644 --- a/src/gui_x11.c +++ b/src/gui_x11.c @@ -1167,7 +1167,7 @@ gui_mch_prepare(int *argc, char **argv) * Move all the entries in argv which are relevant to X into gui_argv. */ gui_argc = 0; - gui_argv = (char **)lalloc((long_u)(*argc * sizeof(char *)), FALSE); + gui_argv = (char **)lalloc(*argc * sizeof(char *), FALSE); if (gui_argv == NULL) return; gui_argv[gui_argc++] = argv[0]; diff --git a/src/insexpand.c b/src/insexpand.c index 4a807f48c8..387f0666d8 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -611,7 +611,7 @@ ins_compl_add( // Allocate a new match structure. // Copy the values to the new match structure. - match = (compl_T *)alloc_clear((unsigned)sizeof(compl_T)); + match = (compl_T *)alloc_clear(sizeof(compl_T)); if (match == NULL) return FAIL; match->cp_number = -1; @@ -1071,8 +1071,7 @@ ins_compl_show_pum(void) if (compl_match_arraysize == 0) return; compl_match_array = (pumitem_T *)alloc_clear( - (unsigned)(sizeof(pumitem_T) - * compl_match_arraysize)); + sizeof(pumitem_T) * compl_match_arraysize); if (compl_match_array != NULL) { // If the current match is the original text don't find the first diff --git a/src/menu.c b/src/menu.c index 1ff45b98da..f32fe4992d 100644 --- a/src/menu.c +++ b/src/menu.c @@ -583,7 +583,7 @@ add_menu_path( } /* Not already there, so lets add it */ - menu = (vimmenu_T *)alloc_clear((unsigned)sizeof(vimmenu_T)); + menu = (vimmenu_T *)alloc_clear(sizeof(vimmenu_T)); if (menu == NULL) goto erret; diff --git a/src/netbeans.c b/src/netbeans.c index f1ba01a082..2d55b80065 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -863,7 +863,7 @@ nb_unquote(char_u *p, char_u **endp) int done = 0; /* result is never longer than input */ - result = (char *)alloc_clear((unsigned)STRLEN(p) + 1); + result = (char *)alloc_clear(STRLEN(p) + 1); if (result == NULL) return NULL; @@ -3210,7 +3210,8 @@ addsigntype( if (globalsignmaplen == 0) /* first allocation */ { globalsignmaplen = 20; - globalsignmap = (char **)alloc_clear(globalsignmaplen*sizeof(char *)); + globalsignmap = (char **)alloc_clear( + globalsignmaplen * sizeof(char *)); } else /* grow it */ { @@ -1160,7 +1160,7 @@ stuff_yank(int regname, char_u *p) if (y_append && y_current->y_array != NULL) { pp = &(y_current->y_array[y_current->y_size - 1]); - lp = lalloc((long_u)(STRLEN(*pp) + STRLEN(p) + 1), TRUE); + lp = alloc(STRLEN(*pp) + STRLEN(p) + 1); if (lp == NULL) { vim_free(p); @@ -3057,8 +3057,8 @@ op_yank(oparg_T *oap, int deleting, int mess) y_current->y_size = yanklines; y_current->y_type = yanktype; /* set the yank register type */ y_current->y_width = 0; - y_current->y_array = (char_u **)lalloc_clear((long_u)(sizeof(char_u *) * - yanklines), TRUE); + y_current->y_array = (char_u **)lalloc_clear(sizeof(char_u *) * yanklines, + TRUE); if (y_current->y_array == NULL) { y_current = curr; @@ -3171,8 +3171,8 @@ op_yank(oparg_T *oap, int deleting, int mess) if (curr != y_current) /* append the new block to the old block */ { - new_ptr = (char_u **)lalloc((long_u)(sizeof(char_u *) * - (curr->y_size + y_current->y_size)), TRUE); + new_ptr = (char_u **)alloc(sizeof(char_u *) * + (curr->y_size + y_current->y_size)); if (new_ptr == NULL) goto fail; for (j = 0; j < curr->y_size; ++j) @@ -3190,8 +3190,8 @@ op_yank(oparg_T *oap, int deleting, int mess) * the new block, unless being Vi compatible. */ if (curr->y_type == MCHAR && vim_strchr(p_cpo, CPO_REGAPPEND) == NULL) { - pnew = lalloc((long_u)(STRLEN(curr->y_array[curr->y_size - 1]) - + STRLEN(y_current->y_array[0]) + 1), TRUE); + pnew = alloc(STRLEN(curr->y_array[curr->y_size - 1]) + + STRLEN(y_current->y_array[0]) + 1); if (pnew == NULL) { y_idx = y_current->y_size - 1; @@ -4453,13 +4453,13 @@ do_join( /* Allocate an array to store the number of spaces inserted before each * line. We will use it to pre-compute the length of the new line and the * proper placement of each original line in the new one. */ - spaces = lalloc_clear((long_u)count, TRUE); + spaces = lalloc_clear(count, TRUE); if (spaces == NULL) return FAIL; #if defined(FEAT_COMMENTS) || defined(PROTO) if (remove_comments) { - comments = (int *)lalloc_clear((long_u)count * sizeof(int), TRUE); + comments = (int *)lalloc_clear(count * sizeof(int), TRUE); if (comments == NULL) { vim_free(spaces); @@ -4571,8 +4571,8 @@ do_join( // Allocate an array to copy the text properties of joined lines into. // And another array to store the number of properties in each line. prop_lines = (textprop_T **)alloc_clear( - (int)(count - 1) * sizeof(textprop_T *)); - prop_lengths = (int *)alloc_clear((int)(count - 1) * sizeof(int)); + (count - 1) * sizeof(textprop_T *)); + prop_lengths = (int *)alloc_clear((count - 1) * sizeof(int)); if (prop_lengths == NULL) VIM_CLEAR(prop_lines); } @@ -6600,7 +6600,7 @@ clip_convert_selection(char_u **str, long_u *len, VimClipboard *cbd) if (y_ptr->y_type == MCHAR && *len >= eolsize) *len -= eolsize; - p = *str = lalloc(*len + 1, TRUE); /* add one to avoid zero */ + p = *str = alloc(*len + 1); // add one to avoid zero if (p == NULL) return -1; lnum = 0; @@ -6818,7 +6818,7 @@ get_reg_contents(int regname, int flags) ++len; } - retval = lalloc(len + 1, TRUE); + retval = alloc(len + 1); /* * Copy the lines of the yank register into the string. diff --git a/src/os_amiga.c b/src/os_amiga.c index ec392cd7f7..d99c19886b 100644 --- a/src/os_amiga.c +++ b/src/os_amiga.c @@ -1448,7 +1448,7 @@ mch_expandpath( #ifdef __amigaos4__ Anchor = AllocDosObject(DOS_ANCHORPATH, AnchorTags); #else - Anchor = (struct AnchorPath *)alloc_clear((unsigned)ANCHOR_SIZE); + Anchor = (struct AnchorPath *)alloc_clear(ANCHOR_SIZE); #endif if (Anchor == NULL) return 0; diff --git a/src/os_mswin.c b/src/os_mswin.c index 67989fe28c..6f3e708db8 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -890,7 +890,7 @@ mch_libcall( else if (retval_str != NULL && (len = check_str_len(retval_str)) > 0) { - *string_result = lalloc((long_u)len, TRUE); + *string_result = alloc(len); if (*string_result != NULL) mch_memmove(*string_result, retval_str, len); } diff --git a/src/os_qnx.c b/src/os_qnx.c index 8091599ecd..79b7ec0f68 100644 --- a/src/os_qnx.c +++ b/src/os_qnx.c @@ -120,7 +120,7 @@ clip_mch_set_selection(VimClipboard *cbd) type = clip_convert_selection(&str, &len, cbd); if (type >= 0) { - text_clip = lalloc(len + 1, TRUE); /* Normal text */ + text_clip = alloc(len + 1); // Normal text if (text_clip && vim_clip) { diff --git a/src/os_unix.c b/src/os_unix.c index 0ec48a1127..803f9441c6 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4459,9 +4459,9 @@ mch_call_shell_system( else x = system((char *)cmd); # else - newcmd = lalloc(STRLEN(p_sh) + newcmd = alloc(STRLEN(p_sh) + (extra_shell_arg == NULL ? 0 : STRLEN(extra_shell_arg)) - + STRLEN(p_shcf) + STRLEN(cmd) + 4, TRUE); + + STRLEN(p_shcf) + STRLEN(cmd) + 4); if (newcmd == NULL) x = 0; else diff --git a/src/os_win32.c b/src/os_win32.c index d2907102e0..5bec2a219f 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -3394,7 +3394,7 @@ mch_get_acl(char_u *fname) struct my_acl *p = NULL; DWORD err; - p = (struct my_acl *)alloc_clear((unsigned)sizeof(struct my_acl)); + p = (struct my_acl *)alloc_clear(sizeof(struct my_acl)); if (p != NULL) { WCHAR *wn; @@ -4533,7 +4533,7 @@ mch_call_shell_terminal( cmdlen = STRLEN(p_sh) + 1; else cmdlen = STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10; - newcmd = lalloc(cmdlen, TRUE); + newcmd = alloc(cmdlen); if (newcmd == NULL) return 255; if (cmd == NULL) @@ -4772,7 +4772,7 @@ mch_call_shell( { /* make "cmd.exe /c arguments" */ cmdlen = STRLEN(cmd_shell) + STRLEN(subcmd) + 5; - newcmd = lalloc(cmdlen, TRUE); + newcmd = alloc(cmdlen); if (newcmd != NULL) vim_snprintf((char *)newcmd, cmdlen, "%s /c %s", cmd_shell, subcmd); @@ -4827,7 +4827,7 @@ mch_call_shell( #endif STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10; - newcmd = lalloc(cmdlen, TRUE); + newcmd = alloc(cmdlen); if (newcmd != NULL) { #if defined(FEAT_GUI_MSWIN) diff --git a/src/popupmnu.c b/src/popupmnu.c index 0b002f53e3..e5811d31b1 100644 --- a/src/popupmnu.c +++ b/src/popupmnu.c @@ -1071,7 +1071,7 @@ split_message(char_u *mesg, pumitem_T **array) * position. */ if (height > max_height) height = max_height; - *array = (pumitem_T *)alloc_clear((unsigned)sizeof(pumitem_T) * height); + *array = (pumitem_T *)alloc_clear(sizeof(pumitem_T) * height); if (*array == NULL) goto failed; @@ -1165,7 +1165,7 @@ ui_post_balloon(char_u *mesg, list_T *list) balloon_arraysize = list->lv_len; balloon_array = (pumitem_T *)alloc_clear( - (unsigned)sizeof(pumitem_T) * list->lv_len); + sizeof(pumitem_T) * list->lv_len); if (balloon_array == NULL) return; for (idx = 0, li = list->lv_first; li != NULL; li = li->li_next, ++idx) @@ -1271,7 +1271,7 @@ pum_show_popupmenu(vimmenu_T *menu) return; } - array = (pumitem_T *)alloc_clear((unsigned)sizeof(pumitem_T) * pum_size); + array = (pumitem_T *)alloc_clear(sizeof(pumitem_T) * pum_size); if (array == NULL) return; diff --git a/src/quickfix.c b/src/quickfix.c index 46eae2dd28..69ffc9c286 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -540,7 +540,7 @@ parse_efm_option(char_u *efm) while (efm[0] != NUL) { // Allocate a new eformat structure and put it at the end of the list - fmt_ptr = (efm_T *)alloc_clear((unsigned)sizeof(efm_T)); + fmt_ptr = (efm_T *)alloc_clear(sizeof(efm_T)); if (fmt_ptr == NULL) goto parse_efm_error; if (fmt_first == NULL) // first one @@ -2141,7 +2141,7 @@ qf_alloc_stack(qfltype_T qfltype) { qf_info_T *qi; - qi = (qf_info_T *)alloc_clear((unsigned)sizeof(qf_info_T)); + qi = (qf_info_T *)alloc_clear(sizeof(qf_info_T)); if (qi != NULL) { qi->qf_refcount++; diff --git a/src/regexp.c b/src/regexp.c index 3697cd9837..b090389929 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -1319,7 +1319,7 @@ bt_regcomp(char_u *expr, int re_flags) return NULL; /* Allocate space. */ - r = (bt_regprog_T *)lalloc(sizeof(bt_regprog_T) + regsize, TRUE); + r = (bt_regprog_T *)alloc(sizeof(bt_regprog_T) + regsize); if (r == NULL) return NULL; r->re_in_use = FALSE; @@ -3932,7 +3932,7 @@ make_extmatch(void) { reg_extmatch_T *em; - em = (reg_extmatch_T *)alloc_clear((unsigned)sizeof(reg_extmatch_T)); + em = (reg_extmatch_T *)alloc_clear(sizeof(reg_extmatch_T)); if (em != NULL) em->refcnt = 1; return em; @@ -7830,7 +7830,7 @@ reg_submatch(int no) if (retval == NULL) { - retval = lalloc((long_u)len, TRUE); + retval = alloc(len); if (retval == NULL) return NULL; } diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index a214b4a3fa..f81c05d76c 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -300,7 +300,7 @@ nfa_regcomp_start( /* Size for postfix representation of expr. */ postfix_size = sizeof(int) * nstate_max; - post_start = (int *)lalloc(postfix_size, TRUE); + post_start = (int *)alloc(postfix_size); if (post_start == NULL) return FAIL; post_ptr = post_start; @@ -516,7 +516,7 @@ realloc_post_list(void) // For weird patterns the number of states can be very high. Increasing by // 50% seems a reasonable compromise between memory use and speed. new_max = nstate_max * 3 / 2; - new_start = (int *)lalloc(new_max * sizeof(int), TRUE); + new_start = (int *)alloc(new_max * sizeof(int)); if (new_start == NULL) return FAIL; mch_memmove(new_start, post_start, nstate_max * sizeof(int)); @@ -3214,7 +3214,7 @@ post2nfa(int *postfix, int *end, int nfa_calc_size) if (nfa_calc_size == FALSE) { // Allocate space for the stack. Max states on the stack: "nstate'. - stack = (Frag_T *)lalloc((nstate + 1) * sizeof(Frag_T), TRUE); + stack = (Frag_T *) |