]> granicus.if.org Git - vim/commitdiff
updated for version 7.0041
authorBram Moolenaar <Bram@vim.org>
Mon, 17 Jan 2005 22:18:45 +0000 (22:18 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 17 Jan 2005 22:18:45 +0000 (22:18 +0000)
src/misc1.c

index 0bdcce8b15aabd479381ee25f5b5f3c3d4af3a64..4c2b55e918ccbdf1644a307e1e7bd8e220f6bd1c 100644 (file)
@@ -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.