1
0
forked from aniani/vim

patch 8.1.0806: too many #ifdefs

Problem:    Too many #ifdefs.
Solution:   Graduate FEAT_MBYTE, part 2.
This commit is contained in:
Bram Moolenaar
2019-01-24 15:54:21 +01:00
parent 135059724f
commit fc3abf47fb
21 changed files with 165 additions and 1137 deletions

View File

@@ -440,20 +440,11 @@ serverSendToVim(
* comm window in the communication window.
* Length must be computed exactly!
*/
#ifdef FEAT_MBYTE
length = STRLEN(name) + STRLEN(p_enc) + STRLEN(cmd) + 14;
#else
length = STRLEN(name) + STRLEN(cmd) + 10;
#endif
property = (char_u *)alloc((unsigned)length + 30);
#ifdef FEAT_MBYTE
sprintf((char *)property, "%c%c%c-n %s%c-E %s%c-s %s",
0, asExpr ? 'c' : 'k', 0, name, 0, p_enc, 0, cmd);
#else
sprintf((char *)property, "%c%c%c-n %s%c-s %s",
0, asExpr ? 'c' : 'k', 0, name, 0, cmd);
#endif
if (name == loosename)
vim_free(loosename);
/* Add a back reference to our comm window */
@@ -758,20 +749,11 @@ serverSendReply(char_u *name, char_u *str)
if (!WindowValid(dpy, win))
return -1;
#ifdef FEAT_MBYTE
length = STRLEN(p_enc) + STRLEN(str) + 14;
#else
length = STRLEN(str) + 10;
#endif
if ((property = (char_u *)alloc((unsigned)length + 30)) != NULL)
{
#ifdef FEAT_MBYTE
sprintf((char *)property, "%cn%c-E %s%c-n %s%c-w %x",
0, 0, p_enc, 0, str, 0, (unsigned int)commWindow);
#else
sprintf((char *)property, "%cn%c-n %s%c-w %x",
0, 0, str, 0, (unsigned int)commWindow);
#endif
/* Add length of what "%x" resulted in. */
length += STRLEN(property + length);
res = AppendPropCarefully(dpy, win, commProperty, property, length + 1);
@@ -1334,17 +1316,10 @@ server_parse_message(
/* Initialize the result property. */
ga_init2(&reply, 1, 100);
#ifdef FEAT_MBYTE
(void)ga_grow(&reply, 50 + STRLEN(p_enc));
sprintf(reply.ga_data, "%cr%c-E %s%c-s %s%c-r ",
0, 0, p_enc, 0, serial, 0);
reply.ga_len = 14 + STRLEN(p_enc) + STRLEN(serial);
#else
(void)ga_grow(&reply, 50);
sprintf(reply.ga_data, "%cr%c-s %s%c-r ",
0, 0, serial, 0);
reply.ga_len = 10 + STRLEN(serial);
#endif
/* Evaluate the expression and return the result. */
if (res != NULL)