From 58abc75abbc77af28d7557e2b0712896cfb4eb61 Mon Sep 17 00:00:00 2001 From: skimo Date: Sat, 2 Sep 2000 13:14:14 +0000 Subject: [PATCH] fix use of RE_W{START,STOP} in wide char version --- common/screen.h | 4 +++- ex/ex_subst.c | 18 +++++++++--------- vi/v_search.c | 10 +++++----- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/common/screen.h b/common/screen.h index 56168c25..56fbc5e2 100644 --- a/common/screen.h +++ b/common/screen.h @@ -6,7 +6,7 @@ * * See the LICENSE file for redistribution information. * - * $Id: screen.h,v 10.39 2000/07/23 17:32:16 skimo Exp $ (Berkeley) $Date: 2000/07/23 17:32:16 $ + * $Id: screen.h,v 10.40 2000/09/02 13:14:14 skimo Exp $ (Berkeley) $Date: 2000/09/02 13:14:14 $ */ /* @@ -159,6 +159,8 @@ struct _scr { #define RE_WSTART "[[:<:]]" /* Ex/vi: not-in-word search pattern. */ #define RE_WSTOP "[[:>:]]" #endif +#define RE_WSTART_LEN (sizeof(RE_WSTART)/sizeof(CHAR_T)) +#define RE_WSTOP_LEN (sizeof(RE_WSTOP)/sizeof(CHAR_T)) /* Ex/vi: flags to search routines. */ #define SEARCH_CSCOPE 0x000001 /* Search for a cscope pattern. */ #define SEARCH_CSEARCH 0x000002 /* Compile search replacement. */ diff --git a/ex/ex_subst.c b/ex/ex_subst.c index 8b647abf..f77f1e0a 100644 --- a/ex/ex_subst.c +++ b/ex/ex_subst.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: ex_subst.c,v 10.45 2000/07/16 20:49:32 skimo Exp $ (Berkeley) $Date: 2000/07/16 20:49:32 $"; +static const char sccsid[] = "$Id: ex_subst.c,v 10.46 2000/09/02 13:14:15 skimo Exp $ (Berkeley) $Date: 2000/09/02 13:14:15 $"; #endif /* not lint */ #include @@ -1063,11 +1063,11 @@ re_conv(sp, ptrnp, plenp, replacedp) switch (*++p) { case '<': magic = 1; - needlen += sizeof(RE_WSTART); + needlen += RE_WSTART_LEN; break; case '>': magic = 1; - needlen += sizeof(RE_WSTOP); + needlen += RE_WSTOP_LEN; break; case '~': if (!O_ISSET(sp, O_MAGIC)) { @@ -1124,14 +1124,14 @@ re_conv(sp, ptrnp, plenp, replacedp) --len; switch (*++p) { case '<': - memcpy(t, - RE_WSTART, sizeof(RE_WSTART) - 1); - t += sizeof(RE_WSTART) - 1; + MEMCPY(t, + RE_WSTART, RE_WSTART_LEN - 1); + t += RE_WSTART_LEN - 1; break; case '>': - memcpy(t, - RE_WSTOP, sizeof(RE_WSTOP) - 1); - t += sizeof(RE_WSTOP) - 1; + MEMCPY(t, + RE_WSTOP, RE_WSTOP_LEN - 1); + t += RE_WSTOP_LEN - 1; break; case '~': if (O_ISSET(sp, O_MAGIC)) diff --git a/vi/v_search.c b/vi/v_search.c index 3d2a2609..2a02e6ee 100644 --- a/vi/v_search.c +++ b/vi/v_search.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: v_search.c,v 10.26 2000/07/15 20:26:36 skimo Exp $ (Berkeley) $Date: 2000/07/15 20:26:36 $"; +static const char sccsid[] = "$Id: v_search.c,v 10.27 2000/09/02 13:14:16 skimo Exp $ (Berkeley) $Date: 2000/09/02 13:14:16 $"; #endif /* not lint */ #include @@ -339,13 +339,13 @@ v_searchw(sp, vp) int rval; CHAR_T *bp, *p; - len = VIP(sp)->klen + sizeof(RE_WSTART) + sizeof(RE_WSTOP); + len = VIP(sp)->klen + RE_WSTART_LEN + RE_WSTOP_LEN; GET_SPACE_RETW(sp, bp, blen, len); - memcpy(bp, RE_WSTART, sizeof(RE_WSTART)); + MEMCPY(bp, RE_WSTART, RE_WSTART_LEN); p = bp + sizeof(RE_WSTART)/sizeof(CHAR_T) - 1; - MEMCPYW(p, VIP(sp)->keyw, VIP(sp)->klen); + MEMCPY(p, VIP(sp)->keyw, VIP(sp)->klen); p += VIP(sp)->klen; - memcpy(bp, RE_WSTOP, sizeof(RE_WSTOP)); + MEMCPY(bp, RE_WSTOP, RE_WSTOP_LEN); rval = v_search(sp, vp, bp, len, SEARCH_SET, FORWARD); -- 2.11.4.GIT