aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/typval_encode.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/eval/typval_encode.c.h')
-rw-r--r--src/nvim/eval/typval_encode.c.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/nvim/eval/typval_encode.c.h b/src/nvim/eval/typval_encode.c.h
index c0cd0ce557..c0e994562c 100644
--- a/src/nvim/eval/typval_encode.c.h
+++ b/src/nvim/eval/typval_encode.c.h
@@ -6,6 +6,11 @@
/// something else. For these macros to work the following macros must be
/// defined:
+/// @def TYPVAL_ENCODE_CHECK_BEFORE
+/// @brief Macro used before any specific CONV function
+///
+/// can be used for a common check, like flushing a buffer if necessary
+
/// @def TYPVAL_ENCODE_CONV_NIL
/// @brief Macros used to convert NIL value
///
@@ -168,8 +173,7 @@
/// point to a special dictionary.
/// @param dict Converted dictionary, lvalue or #TYPVAL_ENCODE_NODICT_VAR
/// (for dictionaries represented as special lists).
-/// @param len Dictionary length. Is an expression which evaluates to an
-/// integer.
+/// @param len Dict length. Is an expression which evaluates to an integer.
/// @def TYPVAL_ENCODE_CONV_REAL_DICT_AFTER_START
/// @brief Macros used after pushing dictionary onto the stack
@@ -323,6 +327,7 @@ static int TYPVAL_ENCODE_CONVERT_ONE_VALUE(
TYPVAL_ENCODE_FIRST_ARG_TYPE TYPVAL_ENCODE_FIRST_ARG_NAME, MPConvStack *const mpstack,
MPConvStackVal *const cur_mpsv, typval_T *const tv, const int copyID, const char *const objname)
{
+ TYPVAL_ENCODE_CHECK_BEFORE;
switch (tv->v_type) {
case VAR_STRING:
TYPVAL_ENCODE_CONV_STRING(tv, tv->vval.v_string, tv_strlen(tv));
@@ -420,6 +425,7 @@ static int TYPVAL_ENCODE_CONVERT_ONE_VALUE(
break;
}
}
+ TYPVAL_ENCODE_CHECK_BEFORE;
if (i == ARRAY_SIZE(eval_msgpack_type_lists)) {
goto _convert_one_value_regular_dict;
}
@@ -494,9 +500,7 @@ static int TYPVAL_ENCODE_CONVERT_ONE_VALUE(
}
TYPVAL_ENCODE_CONV_FLOAT(tv, val_di->di_tv.vval.v_float);
break;
- case kMPString:
- case kMPBinary: {
- const bool is_string = ((MessagePackType)i == kMPString);
+ case kMPString: {
if (val_di->di_tv.v_type != VAR_LIST) {
goto _convert_one_value_regular_dict;
}
@@ -506,11 +510,7 @@ static int TYPVAL_ENCODE_CONVERT_ONE_VALUE(
&buf)) {
goto _convert_one_value_regular_dict;
}
- if (is_string) {
- TYPVAL_ENCODE_CONV_STR_STRING(tv, buf, len);
- } else {
- TYPVAL_ENCODE_CONV_STRING(tv, buf, len);
- }
+ TYPVAL_ENCODE_CONV_STR_STRING(tv, buf, len);
xfree(buf);
break;
}