Problem: Items on the stack may be too big.
Solution: Make items static or allocate them.
typval_T *argvars UNUSED;
typval_T *rettv;
{
- char_u cwd[MAXPATHL];
+ char_u *cwd;
rettv->v_type = VAR_STRING;
- if (mch_dirname(cwd, MAXPATHL) == FAIL)
- rettv->vval.v_string = NULL;
- else
+ rettv->vval.v_string = NULL;
+ cwd = alloc(MAXPATHL);
+ if (cwd != NULL)
{
- rettv->vval.v_string = vim_strsave(cwd);
+ if (mch_dirname(cwd, MAXPATHL) != FAIL)
+ {
+ rettv->vval.v_string = vim_strsave(cwd);
#ifdef BACKSLASH_IN_FILENAME
- if (rettv->vval.v_string != NULL)
- slash_adjust(rettv->vval.v_string);
+ if (rettv->vval.v_string != NULL)
+ slash_adjust(rettv->vval.v_string);
#endif
+ }
+ vim_free(cwd);
}
}
typval_T *rettv;
{
char_u *p;
+#ifdef HAVE_READLINK
+ char_u *buf = NULL;
+#endif
p = get_tv_string(&argvars[0]);
#ifdef FEAT_SHORTCUT
#else
# ifdef HAVE_READLINK
{
- char_u buf[MAXPATHL + 1];
char_u *cpy;
int len;
char_u *remain = NULL;
q[-1] = NUL;
}
+ buf = alloc(MAXPATHL + 1);
+ if (buf == NULL)
+ goto fail;
+
for (;;)
{
for (;;)
#ifdef HAVE_READLINK
fail:
+ vim_free(buf);
#endif
rettv->v_type = VAR_STRING;
}
typval_T *argvars UNUSED;
typval_T *rettv;
{
- char_u fname[MAXPATHL + 1];
+ char_u *fname;
tagname_T tn;
int first;
if (rettv_list_alloc(rettv) == FAIL)
return;
+ fname = alloc(MAXPATHL);
+ if (fname == NULL)
+ return;
for (first = TRUE; ; first = FALSE)
if (get_tagfname(&tn, first, fname) == FAIL
|| list_append_string(rettv->vval.v_list, fname, -1) == FAIL)
break;
tagname_free(&tn);
+ vim_free(fname);
}
/*
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
if (p_confirm || cmdmod.confirm)
{
- char_u buff[IOSIZE];
+ char_u buff[DIALOG_MSG_SIZE];
dialog_msg(buff, _("Overwrite existing file \"%s\"?"), fname);
if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 2) != VIM_YES)
/* For ":w! filename" check that no swap file exists for "filename". */
if (other && !emsg_silent)
{
- char_u dir[MAXPATHL];
+ char_u *dir;
char_u *p;
int r;
char_u *swapname;
* Use 'shortname' of the current buffer, since there is no buffer
* for the written file. */
if (*p_dir == NUL)
+ {
+ dir = alloc(5);
+ if (dir == NULL)
+ return FAIL;
STRCPY(dir, ".");
+ }
else
{
+ dir = alloc(MAXPATHL);
+ if (dir == NULL)
+ return FAIL;
p = p_dir;
copy_option_part(&p, dir, MAXPATHL, ",");
}
swapname = makeswapname(fname, ffname, curbuf, dir);
+ vim_free(dir);
r = vim_fexists(swapname);
if (r)
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
if (p_confirm || cmdmod.confirm)
{
- char_u buff[IOSIZE];
+ char_u buff[DIALOG_MSG_SIZE];
dialog_msg(buff,
_("Swap file \"%s\" exists, overwrite anyway?"),
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
if ((p_confirm || cmdmod.confirm) && buf->b_fname != NULL)
{
- char_u buff[IOSIZE];
+ char_u buff[DIALOG_MSG_SIZE];
if (buf->b_p_ro)
dialog_msg(buff, _("'readonly' option is set for \"%s\".\nDo you wish to write anyway?"),
buf_T *buf;
int checkall; /* may abandon all changed buffers */
{
- char_u buff[IOSIZE];
+ char_u buff[DIALOG_MSG_SIZE];
int ret;
buf_T *buf2;
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
if ((p_confirm || cmdmod.confirm) && curbuf->b_fname != NULL)
{
- char_u buff[IOSIZE];
+ char_u buff[DIALOG_MSG_SIZE];
if (n == 1)
vim_strncpy(buff,
(char_u *)_("1 more file to edit. Quit anyway?"),
- IOSIZE - 1);
+ DIALOG_MSG_SIZE - 1);
else
- vim_snprintf((char *)buff, IOSIZE,
+ vim_snprintf((char *)buff, DIALOG_MSG_SIZE,
_("%d more files to edit. Quit anyway?"), n);
if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 1) == VIM_YES)
return OK;
failed = TRUE;
if (eap->cmdidx == CMD_mksession)
{
- char_u dirnow[MAXPATHL]; /* current directory */
+ char_u *dirnow; /* current directory */
- /*
- * Change to session file's dir.
- */
- if (mch_dirname(dirnow, MAXPATHL) == FAIL
- || mch_chdir((char *)dirnow) != 0)
- *dirnow = NUL;
- if (*dirnow != NUL && (ssop_flags & SSOP_SESDIR))
- {
- if (vim_chdirfile(fname) == OK)
- shorten_fnames(TRUE);
- }
- else if (*dirnow != NUL
- && (ssop_flags & SSOP_CURDIR) && globaldir != NULL)
+ dirnow = alloc(MAXPATHL);
+ if (dirnow == NULL)
+ failed = TRUE;
+ else
{
- if (mch_chdir((char *)globaldir) == 0)
- shorten_fnames(TRUE);
- }
+ /*
+ * Change to session file's dir.
+ */
+ if (mch_dirname(dirnow, MAXPATHL) == FAIL
+ || mch_chdir((char *)dirnow) != 0)
+ *dirnow = NUL;
+ if (*dirnow != NUL && (ssop_flags & SSOP_SESDIR))
+ {
+ if (vim_chdirfile(fname) == OK)
+ shorten_fnames(TRUE);
+ }
+ else if (*dirnow != NUL
+ && (ssop_flags & SSOP_CURDIR) && globaldir != NULL)
+ {
+ if (mch_chdir((char *)globaldir) == 0)
+ shorten_fnames(TRUE);
+ }
- failed |= (makeopens(fd, dirnow) == FAIL);
+ failed |= (makeopens(fd, dirnow) == FAIL);
- /* restore original dir */
- if (*dirnow != NUL && ((ssop_flags & SSOP_SESDIR)
+ /* restore original dir */
+ if (*dirnow != NUL && ((ssop_flags & SSOP_SESDIR)
|| ((ssop_flags & SSOP_CURDIR) && globaldir != NULL)))
- {
- if (mch_chdir((char *)dirnow) != 0)
- EMSG(_(e_prev_dir));
- shorten_fnames(TRUE);
+ {
+ if (mch_chdir((char *)dirnow) != 0)
+ EMSG(_(e_prev_dir));
+ shorten_fnames(TRUE);
+ }
+ vim_free(dirnow);
}
}
else
else if (eap->cmdidx == CMD_mksession)
{
/* successful session write - set this_session var */
- char_u tbuf[MAXPATHL];
+ char_u *tbuf;
- if (vim_FullName(fname, tbuf, MAXPATHL, FALSE) == OK)
- set_vim_var_string(VV_THIS_SESSION, tbuf, -1);
+ tbuf = alloc(MAXPATHL);
+ if (tbuf != NULL)
+ {
+ if (vim_FullName(fname, tbuf, MAXPATHL, FALSE) == OK)
+ set_vim_var_string(VV_THIS_SESSION, tbuf, -1);
+ vim_free(tbuf);
+ }
}
#endif
#ifdef MKSESSION_NL
unsigned *flagp;
{
int i;
- char_u buf[MAXPATHL];
+ char_u *buf = NULL;
char_u *s;
if (gap->ga_len == 0)
{
if (fullname)
{
- (void)vim_FullName(s, buf, MAXPATHL, FALSE);
- s = buf;
+ buf = alloc(MAXPATHL);
+ if (buf != NULL)
+ {
+ (void)vim_FullName(s, buf, MAXPATHL, FALSE);
+ s = buf;
+ }
}
if (fputs(" ", fd) < 0 || ses_put_fname(fd, s, flagp) == FAIL)
+ {
+ vim_free(buf);
return FAIL;
+ }
+ vim_free(buf);
}
}
return put_eol(fd);
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) || defined(PROTO)
/*
- * Make a dialog message in "buff[IOSIZE]".
+ * Make a dialog message in "buff[DIALOG_MSG_SIZE]".
* "format" must contain "%s".
*/
void
{
if (fname == NULL)
fname = (char_u *)_("Untitled");
- vim_snprintf((char *)buff, IOSIZE, format, fname);
+ vim_snprintf((char *)buff, DIALOG_MSG_SIZE, format, fname);
}
#endif
shorten_fname1(full_path)
char_u *full_path;
{
- char_u dirname[MAXPATHL];
+ char_u *dirname;
char_u *p = full_path;
+ dirname = alloc(MAXPATHL);
+ if (dirname == NULL)
+ return full_path;
if (mch_dirname(dirname, MAXPATHL) == OK)
{
p = shorten_fname(full_path, dirname);
if (p == NULL || *p == NUL)
p = full_path;
}
+ vim_free(dirname);
return p;
}
#endif
char *name;
struct prt_ps_resource_S *resource;
{
- char_u buffer[MAXPATHL + 1];
+ char_u *buffer;
+ int retval;
+
+ buffer = alloc(MAXPATHL + 1);
+ if (buffer == NULL)
+ return FALSE;
vim_strncpy(resource->name, (char_u *)name, 63);
/* Look for named resource file in runtimepath */
vim_strcat(buffer, (char_u *)name, MAXPATHL);
vim_strcat(buffer, (char_u *)".ps", MAXPATHL);
resource->filename[0] = NUL;
- return (do_in_runtimepath(buffer, FALSE, prt_resource_name,
+ retval = (do_in_runtimepath(buffer, FALSE, prt_resource_name,
resource->filename)
&& resource->filename[0] != NUL);
+ vim_free(buffer);
+ return retval;
}
/* PS CR and LF characters have platform independent values */
double right;
double top;
double bottom;
- struct prt_ps_resource_S res_prolog;
- struct prt_ps_resource_S res_encoding;
+ struct prt_ps_resource_S *res_prolog;
+ struct prt_ps_resource_S *res_encoding;
char buffer[256];
char_u *p_encoding;
char_u *p;
#ifdef FEAT_MBYTE
- struct prt_ps_resource_S res_cidfont;
- struct prt_ps_resource_S res_cmap;
+ struct prt_ps_resource_S *res_cidfont;
+ struct prt_ps_resource_S *res_cmap;
#endif
+ int retval = FALSE;
+
+ res_prolog = (struct prt_ps_resource_S *)
+ alloc(sizeof(struct prt_ps_resource_S));
+ res_encoding = (struct prt_ps_resource_S *)
+ alloc(sizeof(struct prt_ps_resource_S));
+#ifdef FEAT_MBYTE
+ res_cidfont = (struct prt_ps_resource_S *)
+ alloc(sizeof(struct prt_ps_resource_S));
+ res_cmap = (struct prt_ps_resource_S *)
+ alloc(sizeof(struct prt_ps_resource_S));
+#endif
+ if (res_prolog == NULL || res_encoding == NULL
+#ifdef FEAT_MBYTE
+ || res_cidfont == NULL || res_cmap == NULL
+#endif
+ )
+ goto theend;
/*
* PS DSC Header comments - no PS code!
#endif
/* Search for external resources VIM supplies */
- if (!prt_find_resource("prolog", &res_prolog))
+ if (!prt_find_resource("prolog", res_prolog))
{
EMSG(_("E456: Can't find PostScript resource file \"prolog.ps\""));
return FALSE;
}
- if (!prt_open_resource(&res_prolog))
+ if (!prt_open_resource(res_prolog))
return FALSE;
- if (!prt_check_resource(&res_prolog, PRT_PROLOG_VERSION))
+ if (!prt_check_resource(res_prolog, PRT_PROLOG_VERSION))
return FALSE;
#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
/* Look for required version of multi-byte printing procset */
- if (!prt_find_resource("cidfont", &res_cidfont))
+ if (!prt_find_resource("cidfont", res_cidfont))
{
EMSG(_("E456: Can't find PostScript resource file \"cidfont.ps\""));
return FALSE;
}
- if (!prt_open_resource(&res_cidfont))
+ if (!prt_open_resource(res_cidfont))
return FALSE;
- if (!prt_check_resource(&res_cidfont, PRT_CID_PROLOG_VERSION))
+ if (!prt_check_resource(res_cidfont, PRT_CID_PROLOG_VERSION))
return FALSE;
}
#endif
#endif
p_encoding = enc_skip(p_penc);
if (*p_encoding == NUL
- || !prt_find_resource((char *)p_encoding, &res_encoding))
+ || !prt_find_resource((char *)p_encoding, res_encoding))
{
/* 'printencoding' not set or not supported - find alternate */
#ifdef FEAT_MBYTE
p_encoding = enc_skip(p_enc);
props = enc_canon_props(p_encoding);
if (!(props & ENC_8BIT)
- || !prt_find_resource((char *)p_encoding, &res_encoding))
+ || !prt_find_resource((char *)p_encoding, res_encoding))
/* 8-bit 'encoding' is not supported */
#endif
{
/* Use latin1 as default printing encoding */
p_encoding = (char_u *)"latin1";
- if (!prt_find_resource((char *)p_encoding, &res_encoding))
+ if (!prt_find_resource((char *)p_encoding, res_encoding))
{
EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
p_encoding);
}
}
}
- if (!prt_open_resource(&res_encoding))
+ if (!prt_open_resource(res_encoding))
return FALSE;
/* For the moment there are no checks on encoding resource files to
* perform */
if (prt_use_courier)
{
/* Include ASCII range encoding vector */
- if (!prt_find_resource(prt_ascii_encoding, &res_encoding))
+ if (!prt_find_resource(prt_ascii_encoding, res_encoding))
{
EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
prt_ascii_encoding);
return FALSE;
}
- if (!prt_open_resource(&res_encoding))
+ if (!prt_open_resource(res_encoding))
return FALSE;
/* For the moment there are no checks on encoding resource files to
* perform */
if (prt_out_mbyte && prt_custom_cmap)
{
/* Find user supplied CMap */
- if (!prt_find_resource(prt_cmap, &res_cmap))
+ if (!prt_find_resource(prt_cmap, res_cmap))
{
EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
prt_cmap);
return FALSE;
}
- if (!prt_open_resource(&res_cmap))
+ if (!prt_open_resource(res_cmap))
return FALSE;
}
#endif
/* List resources supplied */
- STRCPY(buffer, res_prolog.title);
+ STRCPY(buffer, res_prolog->title);
STRCAT(buffer, " ");
- STRCAT(buffer, res_prolog.version);
+ STRCAT(buffer, res_prolog->version);
prt_dsc_resources("DocumentSuppliedResources", "procset", buffer);
#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
- STRCPY(buffer, res_cidfont.title);
+ STRCPY(buffer, res_cidfont->title);
STRCAT(buffer, " ");
- STRCAT(buffer, res_cidfont.version);
+ STRCAT(buffer, res_cidfont->version);
prt_dsc_resources(NULL, "procset", buffer);
if (prt_custom_cmap)
{
- STRCPY(buffer, res_cmap.title);
+ STRCPY(buffer, res_cmap->title);
STRCAT(buffer, " ");
- STRCAT(buffer, res_cmap.version);
+ STRCAT(buffer, res_cmap->version);
prt_dsc_resources(NULL, "cmap", buffer);
}
}
if (!prt_out_mbyte || prt_use_courier)
#endif
{
- STRCPY(buffer, res_encoding.title);
+ STRCPY(buffer, res_encoding->title);
STRCAT(buffer, " ");
- STRCAT(buffer, res_encoding.version);
+ STRCAT(buffer, res_encoding->version);
prt_dsc_resources(NULL, "encoding", buffer);
}
prt_dsc_requirements(prt_duplex, prt_tumble, prt_collate,
prt_dsc_noarg("BeginProlog");
/* Add required procsets - NOTE: order is important! */
- if (!prt_add_resource(&res_prolog))
+ if (!prt_add_resource(res_prolog))
return FALSE;
#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
/* Add CID font procset, and any user supplied CMap */
- if (!prt_add_resource(&res_cidfont))
+ if (!prt_add_resource(res_cidfont))
return FALSE;
- if (prt_custom_cmap && !prt_add_resource(&res_cmap))
+ if (prt_custom_cmap && !prt_add_resource(res_cmap))
return FALSE;
}
#endif
#endif
/* There will be only one Roman font encoding to be included in the PS
* file. */
- if (!prt_add_resource(&res_encoding))
+ if (!prt_add_resource(res_encoding))
return FALSE;
prt_dsc_noarg("EndProlog");
prt_dsc_noarg("EndSetup");
/* Fail if any problems writing out to the PS file */
- return !prt_file_error;
+ retval = !prt_file_error;
+
+theend:
+ vim_free(res_prolog);
+ vim_free(res_encoding);
+#ifdef FEAT_MBYTE
+ vim_free(res_cidfont);
+ vim_free(res_cmap);
+#endif
+
+ return retval;
}
void
int i;
char_u *inicmd = NULL;
char_u *p;
- char_u cwd[MAXPATHL];
+ char_u *cwd;
if (filec > 0 && filev[0][0] == '+')
{
mainerr_arg_missing((char_u *)filev[-1]);
/* Temporarily cd to the current directory to handle relative file names. */
+ cwd = alloc(MAXPATHL);
+ if (cwd == NULL)
+ return NULL;
if (mch_dirname(cwd, MAXPATHL) != OK)
+ {
+ vim_free(cwd);
return NULL;
- if ((p = vim_strsave_escaped_ext(cwd,
+ }
+ p = vim_strsave_escaped_ext(cwd,
#ifdef BACKSLASH_IN_FILENAME
"", /* rem_backslash() will tell what chars to escape */
#else
PATH_ESC_CHARS,
#endif
- '\\', TRUE)) == NULL)
+ '\\', TRUE);
+ vim_free(cwd);
+ if (p == NULL)
return NULL;
ga_init2(&ga, 1, 100);
ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd ");
char_u *text;
linenr_T lnum;
int col;
- char buf[MAXPATHL * 2 + 25];
+ char *buf;
char_u *p;
/* Don't do anything when 'ballooneval' is off, messages scrolled the
* length. */
if (text != NULL && text[0] != NUL && STRLEN(text) < MAXPATHL)
{
- p = nb_quote(text);
- if (p != NULL)
+ buf = (char *)alloc(MAXPATHL * 2 + 25);
+ if (buf != NULL)
{
- vim_snprintf(buf, sizeof(buf),
- "0:balloonText=%d \"%s\"\n", r_cmdno, p);
- vim_free(p);
+ p = nb_quote(text);
+ if (p != NULL)
+ {
+ vim_snprintf(buf, MAXPATHL * 2 + 25,
+ "0:balloonText=%d \"%s\"\n", r_cmdno, p);
+ vim_free(p);
+ }
+ nbdebug(("EVT: %s", buf));
+ nb_send(buf, "netbeans_beval_cb");
+ vim_free(buf);
}
- nbdebug(("EVT: %s", buf));
- nb_send(buf, "netbeans_beval_cb");
}
vim_free(text);
}
int flags = 0;
colnr_T col;
long tomatch;
- char_u dirname_start[MAXPATHL];
- char_u dirname_now[MAXPATHL];
+ char_u *dirname_start = NULL;
+ char_u *dirname_now = NULL;
char_u *target_dir = NULL;
#ifdef FEAT_AUTOCMD
char_u *au_name = NULL;
goto theend;
}
+ dirname_start = alloc(MAXPATHL);
+ dirname_now = alloc(MAXPATHL);
+ if (dirname_start == NULL || dirname_now == NULL)
+ goto theend;
+
/* Remember the current directory, because a BufRead autocommand that does
* ":lcd %:p:h" changes the meaning of short path names. */
mch_dirname(dirname_start, MAXPATHL);
}
theend:
+ vim_free(dirname_now);
+ vim_free(dirname_start);
vim_free(target_dir);
vim_free(regmatch.regprog);
}
spellinfo_T *spin;
char_u *wfname;
{
- char_u fname[MAXPATHL];
+ char_u *fname = NULL;
int len;
slang_T *slang;
int free_slang = FALSE;
* Write the .sug file.
* Make the file name by changing ".spl" to ".sug".
*/
+ fname = alloc(MAXPATHL);
+ if (fname == NULL)
+ goto theend;
vim_strncpy(fname, wfname, MAXPATHL - 1);
len = (int)STRLEN(fname);
fname[len - 2] = 'u';
sug_write(spin, fname);
theend:
+ vim_free(fname);
if (free_slang)
slang_free(slang);
free_blocks(spin->si_blocks);
int overwrite; /* overwrite existing output file */
int added_word; /* invoked through "zg" */
{
- char_u fname[MAXPATHL];
- char_u wfname[MAXPATHL];
+ char_u *fname = NULL;
+ char_u *wfname;
char_u **innames;
int incount;
afffile_T *(afile[8]);
innames = &fnames[1];
incount = fcount - 1;
+ wfname = alloc(MAXPATHL);
+ if (wfname == NULL)
+ return;
+
if (fcount >= 1)
{
len = (int)STRLEN(fnames[0]);
* "path/en.latin1.add.spl". */
innames = &fnames[0];
incount = 1;
- vim_snprintf((char *)wfname, sizeof(wfname), "%s.spl", fnames[0]);
+ vim_snprintf((char *)wfname, MAXPATHL, "%s.spl", fnames[0]);
}
else if (fcount == 1)
{
/* For ":mkspell path/vim" output file is "path/vim.latin1.spl". */
innames = &fnames[0];
incount = 1;
- vim_snprintf((char *)wfname, sizeof(wfname), SPL_FNAME_TMPL,
+ vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL,
fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc());
}
else if (len > 4 && STRCMP(fnames[0] + len - 4, ".spl") == 0)
{
/* Name ends in ".spl", use as the file name. */
- vim_strncpy(wfname, fnames[0], sizeof(wfname) - 1);
+ vim_strncpy(wfname, fnames[0], MAXPATHL - 1);
}
else
/* Name should be language, make the file name from it. */
- vim_snprintf((char *)wfname, sizeof(wfname), SPL_FNAME_TMPL,
+ vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL,
fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc());
/* Check for .ascii.spl. */
if (!overwrite && mch_stat((char *)wfname, &st) >= 0)
{
EMSG(_(e_exists));
- return;
+ goto theend;
}
if (mch_isdir(wfname))
{
EMSG2(_(e_isadir2), wfname);
- return;
+ goto theend;
}
+ fname = alloc(MAXPATHL);
+ if (fname == NULL)
+ goto theend;
+
/*
* Init the aff and dic pointers.
* Get the region names if there are more than 2 arguments.
|| innames[i][len - 3] != '_')
{
EMSG2(_("E755: Invalid region in %s"), innames[i]);
- return;
+ goto theend;
}
spin.si_region_name[i * 2] = TOLOWER_ASC(innames[i][len - 2]);
spin.si_region_name[i * 2 + 1] =
|| spin.si_prefroot == NULL)
{
free_blocks(spin.si_blocks);
- return;
+ goto theend;
}
/* When not producing a .add.spl file clear the character table when
spin.si_conv.vc_type = CONV_NONE;
spin.si_region = 1 << i;
- vim_snprintf((char *)fname, sizeof(fname), "%s.aff", innames[i]);
+ vim_snprintf((char *)fname, MAXPATHL, "%s.aff", innames[i]);
if (mch_stat((char *)fname, &st) >= 0)
{
/* Read the .aff file. Will init "spin->si_conv" based on the
else
{
/* Read the .dic file and store the words in the trees. */
- vim_snprintf((char *)fname, sizeof(fname), "%s.dic",
+ vim_snprintf((char *)fname, MAXPATHL, "%s.dic",
innames[i]);
if (spell_read_dic(&spin, fname, afile[i]) == FAIL)
error = TRUE;
spell_make_sugfile(&spin, wfname);
}
+
+theend:
+ vim_free(fname);
+ vim_free(wfname);
}
/*
buf_T *buf = NULL;
int new_spf = FALSE;
char_u *fname;
- char_u fnamebuf[MAXPATHL];
+ char_u *fnamebuf = NULL;
char_u line[MAXWLEN * 2];
long fpos, fpos_next = 0;
int i;
EMSG2(_(e_notset), "spellfile");
return;
}
+ fnamebuf = alloc(MAXPATHL);
+ if (fnamebuf == NULL)
+ return;
for (spf = curwin->w_s->b_p_spf, i = 1; *spf != NUL; ++i)
{
if (*spf == NUL)
{
EMSGN(_("E765: 'spellfile' does not have %ld entries"), idx);
+ vim_free(fnamebuf);
return;
}
}
if (buf != NULL && bufIsChanged(buf))
{
EMSG(_(e_bufloaded));
+ vim_free(fnamebuf);
return;
}
redraw_all_later(SOME_VALID);
}
+ vim_free(fnamebuf);
}
/*
static void
init_spellfile()
{
- char_u buf[MAXPATHL];
+ char_u *buf;
int l;
char_u *fname;
char_u *rtp;
if (*curwin->w_s->b_p_spl != NUL && curwin->w_s->b_langp.ga_len > 0)
{
+ buf = alloc(MAXPATHL);
+ if (buf == NULL)
+ return;
+
/* Find the end of the language name. Exclude the region. If there
* is a path separator remember the start of the tail. */
for (lend = curwin->w_s->b_p_spl; *lend != NUL
"/%.*s", (int)(lend - lstart), lstart);
}
l = (int)STRLEN(buf);
- fname = LANGP_ENTRY(curwin->w_s->b_langp, 0)->lp_slang->sl_fname;
+ fname = LANGP_ENTRY(curwin->w_s->b_langp, 0)
+ ->lp_slang->sl_fname;
vim_snprintf((char *)buf + l, MAXPATHL - l, ".%s.add",
fname != NULL
&& strstr((char *)gettail(fname), ".ascii.") != NULL
}
aspath = FALSE;
}
+
+ vim_free(buf);
}
}
{
list_T *list;
char_u tag_name[128 + 1];
- char_u fname[MAXPATHL + 1];
- char_u cmd[CMDBUFFSIZE + 1];
+ char_u *fname;
+ char_u *cmd;
/*
* Add the matching tags to the location list for the current
* window.
*/
+ fname = alloc(MAXPATHL + 1);
+ cmd = alloc(CMDBUFFSIZE + 1);
list = list_alloc();
- if (list == NULL)
+ if (list == NULL || fname == NULL || cmd == NULL)
+ {
+ vim_free(cmd);
+ vim_free(fname);
+ if (list != NULL)
+ list_free(list, TRUE);
goto end_do_tag;
+ }
for (i = 0; i < num_matches; ++i)
{
set_errorlist(curwin, list, ' ', IObuff);
list_free(list, TRUE);
+ vim_free(fname);
+ vim_free(cmd);
cur_match = 0; /* Jump to the first tag */
}
char_u *start; /* start of the value */
char_u *end; /* after the value; can be NULL */
{
- char_u buf[MAXPATHL];
+ char_u *buf;
int len = 0;
+ int retval;
/* check that the field name doesn't exist yet */
if (dict_find(dict, (char_u *)field_name, -1) != NULL)
}
return FAIL;
}
+ buf = alloc(MAXPATHL);
+ if (buf == NULL)
+ return FAIL;
if (start != NULL)
{
if (end == NULL)
--end;
}
len = (int)(end - start);
- if (len > (int)sizeof(buf) - 1)
- len = sizeof(buf) - 1;
+ if (len > MAXPATHL - 1)
+ len = MAXPATHL - 1;
vim_strncpy(buf, start, len);
}
buf[len] = NUL;
- return dict_add_nr_str(dict, field_name, 0L, buf);
+ retval = dict_add_nr_str(dict, field_name, 0L, buf);
+ vim_free(buf);
+ return retval;
}
/*
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 161,
/**/
160,
/**/
#define IOSIZE (1024+1) /* file i/o and sprintf buffer size */
+#define DIALOG_MSG_SIZE 1000 /* buffer size for dialog_msg() */
+
#ifdef FEAT_MBYTE
# define MSG_BUF_LEN 480 /* length of buffer for small messages */
# define MSG_BUF_CLEN (MSG_BUF_LEN / 6) /* cell length (worst case: utf-8
int octspergrp = -1; /* number of octets grouped in output */
int grplen; /* total chars per octet group */
long length = -1, n = 0, seekoff = 0;
- char l[LLEN+1];
+ static char l[LLEN+1]; /* static because it may be too big for stack */
char *pp;
#ifdef AMIGA