Mercurial > vim
comparison src/misc1.c @ 28459:52ef65c0637f v8.2.4754
patch 8.2.4754: using cached values after unsetting some environment variables
Commit: https://github.com/vim/vim/commit/7714231bb5b15f7c85453f3945c108478de1d08a
Author: LemonBoy <thatlemon@gmail.com>
Date: Fri Apr 15 20:50:46 2022 +0100
patch 8.2.4754: using cached values after unsetting some environment variables
Problem: Still using cached values after unsetting some known environment
variables.
Solution: Take care of the side effects. (closes #10194)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 15 Apr 2022 22:00:03 +0200 |
parents | e015d650ea9f |
children | 8bf3198ca147 |
comparison
equal
deleted
inserted
replaced
28458:9335b10b5eb3 | 28459:52ef65c0637f |
---|---|
1908 #else | 1908 #else |
1909 vim_setenv(var, (char_u *)""); | 1909 vim_setenv(var, (char_u *)""); |
1910 #endif | 1910 #endif |
1911 } | 1911 } |
1912 | 1912 |
1913 /* | |
1914 * Removes environment variable "name" and take care of side effects. | |
1915 */ | |
1916 void | |
1917 vim_unsetenv_ext(char_u *var) | |
1918 { | |
1919 vim_unsetenv(var); | |
1920 | |
1921 // "homedir" is not cleared, keep using the old value until $HOME is set. | |
1922 if (STRICMP(var, "VIM") == 0) | |
1923 didset_vim = FALSE; | |
1924 else if (STRICMP(var, "VIMRUNTIME") == 0) | |
1925 didset_vimruntime = FALSE; | |
1926 } | |
1913 | 1927 |
1914 /* | 1928 /* |
1915 * Set environment variable "name" and take care of side effects. | 1929 * Set environment variable "name" and take care of side effects. |
1916 */ | 1930 */ |
1917 void | 1931 void |
1920 vim_setenv(name, val); | 1934 vim_setenv(name, val); |
1921 if (STRICMP(name, "HOME") == 0) | 1935 if (STRICMP(name, "HOME") == 0) |
1922 init_homedir(); | 1936 init_homedir(); |
1923 else if (didset_vim && STRICMP(name, "VIM") == 0) | 1937 else if (didset_vim && STRICMP(name, "VIM") == 0) |
1924 didset_vim = FALSE; | 1938 didset_vim = FALSE; |
1925 else if (didset_vimruntime | 1939 else if (didset_vimruntime && STRICMP(name, "VIMRUNTIME") == 0) |
1926 && STRICMP(name, "VIMRUNTIME") == 0) | |
1927 didset_vimruntime = FALSE; | 1940 didset_vimruntime = FALSE; |
1928 } | 1941 } |
1929 #endif | 1942 #endif |
1930 | 1943 |
1931 /* | 1944 /* |