comparison src/os_win32.c @ 19362:7894f20668b1 v8.2.0239

patch 8.2.0239: MS-Windows: 'env' job option does not override existing vars Commit: https://github.com/vim/vim/commit/355757aed6ae2ae5446882570d89f243e4805937 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Feb 10 22:06:32 2020 +0100 patch 8.2.0239: MS-Windows: 'env' job option does not override existing vars Problem: MS-Windows: 'env' job option does not override existing environment variables. (Tim Pope) Solution: Set the environment variables later. (Yasuhiro Matsumoto, closes #5485, closes #5608)
author Bram Moolenaar <Bram@vim.org>
date Mon, 10 Feb 2020 22:15:03 +0100
parents 16d538568dc8
children 08f4dc2ba716
comparison
equal deleted inserted replaced
19361:54290e4957ce 19362:7894f20668b1
4946 4946
4947 // for last \0 4947 // for last \0
4948 if (ga_grow(gap, 1) == FAIL) 4948 if (ga_grow(gap, 1) == FAIL)
4949 return; 4949 return;
4950 4950
4951 if (base)
4952 {
4953 WCHAR *p = (WCHAR*) base;
4954
4955 // for last \0
4956 if (ga_grow(gap, 1) == FAIL)
4957 return;
4958
4959 while (*p != 0 || *(p + 1) != 0)
4960 {
4961 if (ga_grow(gap, 1) == OK)
4962 *((WCHAR*)gap->ga_data + gap->ga_len++) = *p;
4963 p++;
4964 }
4965 FreeEnvironmentStrings(base);
4966 *((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0';
4967 }
4968
4969 if (env != NULL) 4951 if (env != NULL)
4970 { 4952 {
4971 for (hi = env->dv_hashtab.ht_array; todo > 0; ++hi) 4953 for (hi = env->dv_hashtab.ht_array; todo > 0; ++hi)
4972 { 4954 {
4973 if (!HASHITEM_EMPTY(hi)) 4955 if (!HASHITEM_EMPTY(hi))
4993 } 4975 }
4994 vim_free(wkey); 4976 vim_free(wkey);
4995 vim_free(wval); 4977 vim_free(wval);
4996 } 4978 }
4997 } 4979 }
4980 }
4981
4982 if (base)
4983 {
4984 WCHAR *p = (WCHAR*) base;
4985
4986 // for last \0
4987 if (ga_grow(gap, 1) == FAIL)
4988 return;
4989
4990 while (*p != 0 || *(p + 1) != 0)
4991 {
4992 if (ga_grow(gap, 1) == OK)
4993 *((WCHAR*)gap->ga_data + gap->ga_len++) = *p;
4994 p++;
4995 }
4996 FreeEnvironmentStrings(base);
4997 *((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0';
4998 } 4998 }
4999 4999
5000 # if defined(FEAT_CLIENTSERVER) || defined(FEAT_TERMINAL) 5000 # if defined(FEAT_CLIENTSERVER) || defined(FEAT_TERMINAL)
5001 { 5001 {
5002 # ifdef FEAT_CLIENTSERVER 5002 # ifdef FEAT_CLIENTSERVER