@@ -4243,6 +4243,18 @@ compile_expr7(
42434243 return OK ;
42444244}
42454245
4246+ /*
4247+ * Give the "white on both sides" error, taking the operator from "p[len]".
4248+ */
4249+ void
4250+ error_white_both (char_u * op , int len )
4251+ {
4252+ char_u buf [10 ];
4253+
4254+ vim_strncpy (buf , op , len );
4255+ semsg (_ (e_white_both ), buf );
4256+ }
4257+
42464258/*
42474259 * * number multiplication
42484260 * / number division
@@ -4275,10 +4287,7 @@ compile_expr6(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
42754287
42764288 if (!IS_WHITE_OR_NUL (* * arg ) || !IS_WHITE_OR_NUL (op [1 ]))
42774289 {
4278- char_u buf [3 ];
4279-
4280- vim_strncpy (buf , op , 1 );
4281- semsg (_ (e_white_both ), buf );
4290+ error_white_both (op , 1 );
42824291 return FAIL ;
42834292 }
42844293 * arg = skipwhite (op + 1 );
@@ -4354,10 +4363,7 @@ compile_expr5(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
43544363
43554364 if (!IS_WHITE_OR_NUL (* * arg ) || !IS_WHITE_OR_NUL (op [oplen ]))
43564365 {
4357- char_u buf [3 ];
4358-
4359- vim_strncpy (buf , op , oplen );
4360- semsg (_ (e_white_both ), buf );
4366+ error_white_both (op , oplen );
43614367 return FAIL ;
43624368 }
43634369
@@ -4486,10 +4492,7 @@ compile_expr4(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
44864492
44874493 if (!IS_WHITE_OR_NUL (* * arg ) || !IS_WHITE_OR_NUL (p [len ]))
44884494 {
4489- char_u buf [7 ];
4490-
4491- vim_strncpy (buf , p , len );
4492- semsg (_ (e_white_both ), buf );
4495+ error_white_both (p , len );
44934496 return FAIL ;
44944497 }
44954498
@@ -5132,10 +5135,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
51325135
51335136 if (oplen > 0 && (!VIM_ISWHITE (* sp ) || !VIM_ISWHITE (op [oplen ])))
51345137 {
5135- char_u buf [4 ];
5136-
5137- vim_strncpy (buf , op , oplen );
5138- semsg (_ (e_white_both ), buf );
5138+ error_white_both (op , oplen );
51395139 return NULL ;
51405140 }
51415141
0 commit comments