changeset 115:2201ea50555e

updated for version 7.0041
author vimboss
date Mon, 17 Jan 2005 22:18:45 +0000
parents f6e567606d47
children 973ccf576e2c
files src/misc1.c
diffstat 1 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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.