summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-07-28 14:15:42 +0200
committerBram Moolenaar <Bram@vim.org>2019-07-28 14:15:42 +0200
commit845380791196aec7f991987ebf7b22de3779d106 (patch)
treeadac6010bd9c3bae786a35d1e4109fc01e13e643 /src/eval.c
parentf91aac5e3e3b8b1633d84eac2687ebbd76d8133b (diff)
downloadvim-git-845380791196aec7f991987ebf7b22de3779d106.tar.gz
patch 8.1.1766: code for writing session file is spread outv8.1.1766
Problem: Code for writing session file is spread out. Solution: Put it in one file. (Yegappan Lakshmanan, closes #4728)
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c87
1 files changed, 0 insertions, 87 deletions
diff --git a/src/eval.c b/src/eval.c
index a2d3d9768..278f30700 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -9319,93 +9319,6 @@ script_autoload(
return ret;
}
-#if defined(FEAT_VIMINFO) || defined(FEAT_SESSION)
- var_flavour_T
-var_flavour(char_u *varname)
-{
- char_u *p = varname;
-
- if (ASCII_ISUPPER(*p))
- {
- while (*(++p))
- if (ASCII_ISLOWER(*p))
- return VAR_FLAVOUR_SESSION;
- return VAR_FLAVOUR_VIMINFO;
- }
- else
- return VAR_FLAVOUR_DEFAULT;
-}
-#endif
-
-#if defined(FEAT_SESSION) || defined(PROTO)
- int
-store_session_globals(FILE *fd)
-{
- hashitem_T *hi;
- dictitem_T *this_var;
- int todo;
- char_u *p, *t;
-
- todo = (int)globvarht.ht_used;
- for (hi = globvarht.ht_array; todo > 0; ++hi)
- {
- if (!HASHITEM_EMPTY(hi))
- {
- --todo;
- this_var = HI2DI(hi);
- if ((this_var->di_tv.v_type == VAR_NUMBER
- || this_var->di_tv.v_type == VAR_STRING)
- && var_flavour(this_var->di_key) == VAR_FLAVOUR_SESSION)
- {
- /* Escape special characters with a backslash. Turn a LF and
- * CR into \n and \r. */
- p = vim_strsave_escaped(tv_get_string(&this_var->di_tv),
- (char_u *)"\\\"\n\r");
- if (p == NULL) /* out of memory */
- break;
- for (t = p; *t != NUL; ++t)
- if (*t == '\n')
- *t = 'n';
- else if (*t == '\r')
- *t = 'r';
- if ((fprintf(fd, "let %s = %c%s%c",
- this_var->di_key,
- (this_var->di_tv.v_type == VAR_STRING) ? '"'
- : ' ',
- p,
- (this_var->di_tv.v_type == VAR_STRING) ? '"'
- : ' ') < 0)
- || put_eol(fd) == FAIL)
- {
- vim_free(p);
- return FAIL;
- }
- vim_free(p);
- }
-#ifdef FEAT_FLOAT
- else if (this_var->di_tv.v_type == VAR_FLOAT
- && var_flavour(this_var->di_key) == VAR_FLAVOUR_SESSION)
- {
- float_T f = this_var->di_tv.vval.v_float;
- int sign = ' ';
-
- if (f < 0)
- {
- f = -f;
- sign = '-';
- }
- if ((fprintf(fd, "let %s = %c%f",
- this_var->di_key, sign, f) < 0)
- || put_eol(fd) == FAIL)
- return FAIL;
- }
-#endif
- }
- }
- return OK;
-}
-#endif
-
/*
* Display script name where an item was last set.
* Should only be invoked when 'verbose' is non-zero.