# HG changeset patch # User vimboss # Date 1106000325 0 # Node ID 2201ea50555e729f7dcc43bfc71daa29807833b9 # Parent f6e567606d4776d4fa172877f3051554819bcbde updated for version 7.0041 diff --git a/src/misc1.c b/src/misc1.c --- a/src/misc1.c +++ b/src/misc1.c @@ -3731,12 +3731,10 @@ vim_getenv(name, mustfree) didset_vimruntime = TRUE; #ifdef FEAT_GETTEXT { - char_u *buf = alloc((unsigned int)STRLEN(p) + 6); + char_u *buf = concat_str(p, (char_u *)"/lang"); if (buf != NULL) { - STRCPY(buf, p); - STRCAT(buf, "/lang"); bindtextdomain(VIMPACKAGE, (char *)buf); vim_free(buf); } @@ -4303,6 +4301,29 @@ concat_fnames(fname1, fname2, sep) return dest; } +#if defined(FEAT_EVAL) || defined(FEAT_GETTEXT) || defined(PROTO) +/* + * Concatenate two strings and return the result in allocated memory. + * Returns NULL when out of memory. + */ + char_u * +concat_str(str1, str2) + char_u *str1; + char_u *str2; +{ + char_u *dest; + size_t l = STRLEN(str1); + + dest = alloc((unsigned)(l + STRLEN(str2) + 1L)); + if (dest != NULL) + { + STRCPY(dest, str1); + STRCPY(dest + l, str2); + } + return dest; +} +#endif + /* * Add a path separator to a file name, unless it already ends in a path * separator.