diff --git a/src/eval.c b/src/eval.c index 38805a57a4..0089752339 100644 --- a/src/eval.c +++ b/src/eval.c @@ -5298,7 +5298,7 @@ eval7( * what follows. So set it here. */ if (rettv->v_type == VAR_UNKNOWN && !evaluate && **arg == '(') { - rettv->vval.v_string = vim_strsave((char_u *)""); + rettv->vval.v_string = NULL; rettv->v_type = VAR_FUNC; } @@ -15792,6 +15792,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, int type) listitem_T *li3 = li2->li_next; listitem_T *li4 = li3->li_next; + vim_free(li1->li_tv.vval.v_string); li1->li_tv.vval.v_string = vim_strnsave(regmatch.startp[0], (int)(regmatch.endp[0] - regmatch.startp[0])); li3->li_tv.vval.v_number = @@ -25375,7 +25376,12 @@ func_unref(char_u *name) { fp = find_func(name); if (fp == NULL) - EMSG2(_(e_intern2), "func_unref()"); + { +#ifdef EXITFREE + if (!entered_free_all_mem) +#endif + EMSG2(_(e_intern2), "func_unref()"); + } else if (--fp->uf_refcount <= 0) { /* Only delete it when it's not being used. Otherwise it's done diff --git a/src/globals.h b/src/globals.h index 9b1682f1e8..05f33d8104 100644 --- a/src/globals.h +++ b/src/globals.h @@ -635,6 +635,10 @@ EXTERN int exiting INIT(= FALSE); EXTERN int really_exiting INIT(= FALSE); /* TRUE when we are sure to exit, e.g., after * a deadly signal */ +#if defined(EXITFREE) +EXTERN int entered_free_all_mem INIT(= FALSE); + /* TRUE when in or after free_all_mem() */ +#endif /* volatile because it is used in signal handler deathtrap(). */ EXTERN volatile int full_screen INIT(= FALSE); /* TRUE when doing full-screen output diff --git a/src/if_mzsch.c b/src/if_mzsch.c index 93e4b6cbba..1861df49a0 100644 --- a/src/if_mzsch.c +++ b/src/if_mzsch.c @@ -545,7 +545,7 @@ static void (*dll_scheme_set_config_path)(Scheme_Object *p); # if MZSCHEME_VERSION_MAJOR >= 500 # if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || defined(IMPLEMENT_THREAD_LOCAL_EXTERNALLY_VIA_PROC) -/* define as function for macro in schshread.h */ +/* define as function for macro in schthread.h */ Thread_Local_Variables * scheme_external_get_thread_local_variables(void) { @@ -894,7 +894,7 @@ static void remove_timer(void); /* timers are presented in GUI only */ # if defined(FEAT_GUI_W32) static void CALLBACK -timer_proc(HWND hwnd UNUSED, UINT uMsg UNUSED, UINT idEvent UNUSED, DWORD dwTime UNUSED) +timer_proc(HWND hwnd UNUSED, UINT uMsg UNUSED, UINT_PTR idEvent UNUSED, DWORD dwTime UNUSED) # elif defined(FEAT_GUI_GTK) # if GTK_CHECK_VERSION(3,0,0) static gboolean @@ -3571,7 +3571,7 @@ raise_vim_exn(const char *add_info) info = scheme_make_byte_string(add_info); MZ_GC_CHECK(); - c_string = scheme_format_utf8(fmt, STRLEN(fmt), 1, &info, NULL); + c_string = scheme_format_utf8(fmt, (int)STRLEN(fmt), 1, &info, NULL); MZ_GC_CHECK(); byte_string = scheme_make_byte_string(c_string); MZ_GC_CHECK(); diff --git a/src/if_perl.xs b/src/if_perl.xs index aab7ade227..a4899945fe 100644 --- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -1075,7 +1075,8 @@ perl_to_vim(SV *sv, typval_T *rettv) { size_t len = 0; char * str_from = SvPV(sv, len); - char_u *str_to = (char_u*)alloc(sizeof(char_u) * (len + 1)); + char_u *str_to = (char_u*)alloc( + (unsigned)(sizeof(char_u) * (len + 1))); if (str_to) { str_to[len] = '\0'; @@ -1370,13 +1371,13 @@ PerlIOVim_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count) char_u *str; PerlIOVim * s = PerlIOSelf(f, PerlIOVim); - str = vim_strnsave((char_u *)vbuf, count); + str = vim_strnsave((char_u *)vbuf, (int)count); if (str == NULL) return 0; msg_split((char_u *)str, s->attr); vim_free(str); - return count; + return (SSize_t)count; } static PERLIO_FUNCS_DECL(PerlIO_Vim) = { diff --git a/src/if_py_both.h b/src/if_py_both.h index ce8bacd852..50fd687d96 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -6770,8 +6770,13 @@ populate_module(PyObject *m) return -1; ADD_OBJECT(m, "os", other_module); +#if PY_MAJOR_VERSION >= 3 if (!(py_getcwd = PyObject_GetAttrString(other_module, "getcwd"))) return -1; +#else + if (!(py_getcwd = PyObject_GetAttrString(other_module, "getcwdu"))) + return -1; +#endif ADD_OBJECT(m, "_getcwd", py_getcwd) if (!(py_chdir = PyObject_GetAttrString(other_module, "chdir"))) diff --git a/src/if_ruby.c b/src/if_ruby.c index ac4b5f66ef..0b384e834a 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -741,7 +741,7 @@ vim_str2rb_enc_str(const char *s) vim_free(sval); if (enc) { - return rb_enc_str_new(s, strlen(s), enc); + return rb_enc_str_new(s, (long)strlen(s), enc); } } #endif diff --git a/src/misc2.c b/src/misc2.c index eccb35574d..bc4cd25757 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1036,13 +1036,12 @@ static void free_findfile(void); free_all_mem(void) { buf_T *buf, *nextbuf; - static int entered = FALSE; /* When we cause a crash here it is caught and Vim tries to exit cleanly. * Don't try freeing everything again. */ - if (entered) + if (entered_free_all_mem) return; - entered = TRUE; + entered_free_all_mem = TRUE; # ifdef FEAT_AUTOCMD /* Don't want to trigger autocommands from here on. */ diff --git a/src/version.c b/src/version.c index 84457b84b9..26c0975681 100644 --- a/src/version.c +++ b/src/version.c @@ -768,6 +768,18 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1868, +/**/ + 1867, +/**/ + 1866, +/**/ + 1865, +/**/ + 1864, +/**/ + 1863, /**/ 1862, /**/ @@ -5101,7 +5113,7 @@ do_intro_line( if (*mesg == ' ') { vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1); - l = STRLEN(modby); + l = (int)STRLEN(modby); vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1); mesg = modby; }