diff options
author | Amadeusz Sławiński (amade) <amade@asmblr.net> | 2011-01-05 18:45:01 +0100 |
---|---|---|
committer | Amadeusz Sławiński <amade@asmblr.net> | 2014-05-15 17:30:00 +0200 |
commit | 79fed0e78334fdaf39e9581881fa9e8cd1f64203 (patch) | |
tree | 1e60e3d5e8236a4bca236e016e486f291a9f9270 | |
parent | e90ddc1c274434bdcb65ec3faac6298226c1a54e (diff) | |
download | screen-79fed0e78334fdaf39e9581881fa9e8cd1f64203.tar.gz |
replace bcopy with memmove
-rw-r--r-- | src/ansi.c | 34 | ||||
-rw-r--r-- | src/display.c | 6 | ||||
-rw-r--r-- | src/fileio.c | 4 | ||||
-rw-r--r-- | src/image.h | 24 | ||||
-rw-r--r-- | src/input.c | 4 | ||||
-rw-r--r-- | src/mark.c | 2 | ||||
-rw-r--r-- | src/misc.c | 4 | ||||
-rw-r--r-- | src/process.c | 10 | ||||
-rw-r--r-- | src/resize.c | 12 | ||||
-rw-r--r-- | src/screen.c | 8 | ||||
-rw-r--r-- | src/socket.c | 4 | ||||
-rw-r--r-- | src/termcap.c | 6 | ||||
-rw-r--r-- | src/utmp.c | 8 | ||||
-rw-r--r-- | src/window.c | 16 |
14 files changed, 71 insertions, 71 deletions
@@ -440,7 +440,7 @@ WriteString(struct win *wp, register char *buf, register int len) if (len > IOSIZE + 1) len = IOSIZE + 1; curr->w_outlen = len - 1; - bcopy(buf, curr->w_outbuf, len - 1); + memmove(curr->w_outbuf, buf, len - 1); return; /* wait till status is gone */ } break; @@ -1146,9 +1146,9 @@ DoCSI(int c, int intermediate) a1 = strlen(curr->w_title); if ((unsigned)(curr->w_inlen + 5 + a1) <= sizeof(curr->w_inbuf)) { - bcopy("\033]l", curr->w_inbuf + curr->w_inlen, 3); - bcopy(curr->w_title, curr->w_inbuf + curr->w_inlen + 3, a1); - bcopy("\033\\", curr->w_inbuf + curr->w_inlen + 3 + a1, 2); + memmove(curr->w_inbuf + curr->w_inlen, "\033]l", 3); + memmove(curr->w_inbuf + curr->w_inlen + 3, curr->w_title, a1); + memmove(curr->w_inbuf + curr->w_inlen + 3 + a1, "\033\\", 2); curr->w_inlen += 5 + a1; } break; @@ -1463,7 +1463,7 @@ StringEnd() curr->w_stringp -= p - curr->w_string; if (curr->w_stringp > curr->w_string) - bcopy(p, curr->w_string, curr->w_stringp - curr->w_string); + memmove(curr->w_string, p, curr->w_stringp - curr->w_string); *curr->w_stringp = '\0'; /* FALLTHROUGH */ case APC: @@ -1651,7 +1651,7 @@ SaveCursor(struct cursor *cursor) cursor->Rend = curr->w_rend; cursor->Charset = curr->w_Charset; cursor->CharsetR = curr->w_CharsetR; - bcopy((char *) curr->w_charsets, (char *) cursor->Charsets, + memmove((char *) cursor->Charsets, (char *) curr->w_charsets, 4 * sizeof(int)); } @@ -1664,8 +1664,8 @@ RestoreCursor(struct cursor *cursor) curr->w_x = cursor->x; curr->w_y = cursor->y; curr->w_rend = cursor->Rend; - bcopy((char *) cursor->Charsets, (char *) curr->w_charsets, - 4 * sizeof(int)); + memmove((char *) curr->w_charsets, (char *) cursor->Charsets, + 4 * sizeof(int)); curr->w_Charset = cursor->Charset; curr->w_CharsetR = cursor->CharsetR; curr->w_ss = 0; @@ -2150,7 +2150,7 @@ Report(char *fmt, int n1, int n2) { if ((unsigned)(curr->w_pwin->p_inlen + len) <= sizeof(curr->w_pwin->p_inbuf)) { - bcopy(rbuf, curr->w_pwin->p_inbuf + curr->w_pwin->p_inlen, len); + memmove(curr->w_pwin->p_inbuf + curr->w_pwin->p_inlen, rbuf, len); curr->w_pwin->p_inlen += len; } } @@ -2158,7 +2158,7 @@ Report(char *fmt, int n1, int n2) { if ((unsigned)(curr->w_inlen + len) <= sizeof(curr->w_inbuf)) { - bcopy(rbuf, curr->w_inbuf + curr->w_inlen, len); + memmove(curr->w_inbuf + curr->w_inlen, rbuf, len); curr->w_inlen += len; } } @@ -2390,15 +2390,15 @@ Scroll(char *cp, int cnt1, int cnt2, char *tmp) return; if (cnt1 <= cnt2) { - bcopy(cp, tmp, cnt1); - bcopy(cp + cnt1, cp, cnt2); - bcopy(tmp, cp + cnt2, cnt1); + memmove(tmp, cp, cnt1); + memmove(cp, cp + cnt1, cnt2); + memmove(cp + cnt2, tmp, cnt1); } else { - bcopy(cp + cnt1, tmp, cnt2); - bcopy(cp, cp + cnt2, cnt1); - bcopy(tmp, cp, cnt2); + memmove(tmp, cp + cnt1, cnt2); + memmove(cp + cnt2, cp, cnt1); + memmove(cp, tmp, cnt2); } } @@ -2530,7 +2530,7 @@ MPutStr(struct win *p, char *s, int n, struct mchar *r, int x, int y) ml = &p->w_mlines[y]; MKillDwRight(p, ml, x); MKillDwLeft(p, ml, x + n - 1); - bcopy(s, (char *)ml->image + x, n); + memmove((char *)ml->image + x, s, n); if (ml->attr != null) { b = ml->attr + x; diff --git a/src/display.c b/src/display.c index 701fde4..fd2477c 100644 --- a/src/display.c +++ b/src/display.c @@ -2920,7 +2920,7 @@ disp_writeev_fn(struct event *ev, char *data) len -= size; if (len) { - bcopy(D_obuf + size, D_obuf, len); + memmove(D_obuf, D_obuf + size, len); debug2("ASYNC: wrote %d - remaining %d\n", size, len); } D_obufp -= size; @@ -3126,12 +3126,12 @@ disp_readev_fn(struct event *ev, char *data) } if (bp[0] == '[') { - bcopy((char *)bp + 1, (char *)bp, i); + memmove((char *)bp, (char *)bp + 1, i); bp--; size--; } if (i > 5) - bcopy((char *)bp + 5, (char *)bp, i - 5); + memmove((char *)bp, (char *)bp + 5, i - 5); bp--; i -= 4; size -= 5; diff --git a/src/fileio.c b/src/fileio.c index e5277c4..076e350 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -73,7 +73,7 @@ CatExtra(register char *str1, register char *str2) len2 = strlen(str2); if ((cp = realloc(str2, (unsigned) len1 + len2 + add_colon + 1)) == NULL) Panic(0, "%s", strnomem); - bcopy(cp, cp + len1 + add_colon, len2 + 1); + memmove(cp + len1 + add_colon, cp, len2 + 1); } else { @@ -81,7 +81,7 @@ CatExtra(register char *str1, register char *str2) Panic(0, "%s", strnomem); cp[len1 + add_colon] = '\0'; } - bcopy(str1, cp, len1); + memmove(cp, str1, len1); if (add_colon) cp[len1] = ':'; diff --git a/src/image.h b/src/image.h index 4ac23c3..5475efe 100644 --- a/src/image.h +++ b/src/image.h @@ -63,21 +63,21 @@ IFCOLORX(unsigned char *colorx; ) #define save_mline(ml, n) do { \ - bcopy((char *)(ml)->image, (char *)mline_old.image, (n)); \ - bcopy((char *)(ml)->attr, (char *)mline_old.attr, (n)); \ -IFFONT( bcopy((char *)(ml)->font, (char *)mline_old.font, (n)); ) \ -IFFONTX( bcopy((char *)(ml)->fontx, (char *)mline_old.fontx, (n)); ) \ -IFCOLOR( bcopy((char *)(ml)->color, (char *)mline_old.color, (n)); ) \ -IFCOLORX(bcopy((char *)(ml)->colorx, (char *)mline_old.colorx, (n)); ) \ + memmove((char *)mline_old.image, (char *)(ml)->image, (n)); \ + memmove((char *)mline_old.attr, (char *)(ml)->attr, (n)); \ +IFFONT( memmove((char *)mline_old.font, (char *)(ml)->font, (n)); ) \ +IFFONTX( memmove((char *)mline_old.fontx, (char *)(ml)->font, (n)); ) \ +IFCOLOR( memmove((char *)mline_old.color, (char *)(ml)->color, (n)); ) \ +IFCOLORX(memmove((char *)mline_old.colorx,(char *)(ml)->colorx,(n)); ) \ } while (0) #define bcopy_mline(ml, xf, xt, n) do { \ - bcopy((char *)(ml)->image + (xf), (char *)(ml)->image + (xt), (n)); \ - bcopy((char *)(ml)->attr + (xf), (char *)(ml)->attr + (xt), (n)); \ -IFFONT( bcopy((char *)(ml)->font + (xf), (char *)(ml)->font + (xt), (n)); ) \ -IFFONTX( bcopy((char *)(ml)->fontx + (xf), (char *)(ml)->fontx + (xt), (n)); ) \ -IFCOLOR( bcopy((char *)(ml)->color + (xf), (char *)(ml)->color + (xt), (n)); ) \ -IFCOLORX(bcopy((char *)(ml)->colorx + (xf), (char *)(ml)->colorx + (xt), (n));) \ + memmove((char *)(ml)->image + (xt), (char *)(ml)->image + (xf), (n)); \ + memmove((char *)(ml)->attr + (xt), (char *)(ml)->attr + (xf), (n)); \ +IFFONT( memmove((char *)(ml)->font + (xt), (char *)(ml)->font + (xf), (n)); ) \ +IFFONTX( memmove((char *)(ml)->fontx + (xt), (char *)(ml)->font + (xf), (n)); ) \ +IFCOLOR( memmove((char *)(ml)->color + (xt), (char *)(ml)->color + (xf), (n)); ) \ +IFCOLORX(memmove((char *)(ml)->colorx + (xt),(char *)(ml)->colorx + (xf),(n));) \ } while (0) #define clear_mline(ml, x, n) do { \ diff --git a/src/input.c b/src/input.c index 7a7084d..52faaaa 100644 --- a/src/input.c +++ b/src/input.c @@ -166,7 +166,7 @@ erase_chars(struct inpdata *inpdata, char *from, char *to, int x, int mv) int chng; ASSERT(from < to); if (inpdata->inp.len > to - inpdata->inp.buf) - bcopy(to, from, inpdata->inp.len - (to - inpdata->inp.buf)); + memmove(from, to, inpdata->inp.len - (to - inpdata->inp.buf)); chng = to - from; if (mv) { @@ -241,7 +241,7 @@ InpProcess(char **ppbuf, int *plen) if (((unsigned char)ch & 0177) >= ' ' && ch != 0177 && inpdata->inp.len < inpdata->inpmaxlen) { if (inpdata->inp.len > inpdata->inp.pos) - bcopy(p, p+1, inpdata->inp.len - inpdata->inp.pos); + memmove(p+1, p, inpdata->inp.len - inpdata->inp.pos); inpdata->inp.buf[inpdata->inp.pos++] = ch; inpdata->inp.len++; @@ -458,7 +458,7 @@ GetHistory() /* return value 1 if copybuffer changed */ LMsg(0, "Not enough memory... Sorry."); return 0; } - bcopy((char *)linep - i + x + 1, D_user->u_plop.buf, i - x + 1); + memmove(D_user->u_plop.buf, (char *)linep - i + x + 1, i - x + 1); D_user->u_plop.len = i - x + 1; D_user->u_plop.enc = fore->w_encoding; return 1; @@ -71,7 +71,7 @@ SaveStrn(register const char *str, int n) Panic(0, "%s", strnomem); else { - bcopy((char *)str, cp, n); + memmove(cp, (char *)str, n); cp[n] = 0; } return cp; @@ -305,7 +305,7 @@ xbcopy(register char *s1, register char *s2, register int len) void bclear(char *p, int n) { - bcopy((char *)blank, p, n); + memmove(p, (char *)blank, n); } diff --git a/src/process.c b/src/process.c index 22e117b..28e5717 100644 --- a/src/process.c +++ b/src/process.c @@ -3431,7 +3431,7 @@ DoAction(struct action *act, int key) l += RecodeBuf((unsigned char *)pp->buf, pp->len, pp->enc, enc, (unsigned char *)dbuf + l); continue; } - bcopy(pp->buf, dbuf + l, pp->len); + memmove(dbuf + l, pp->buf, pp->len); l += pp->len; } /* @@ -5715,7 +5715,7 @@ Parse(char *buf, int bufl, char **args, int *argl) int right = buf + bufl - (p + strlen(p) + 1); if (right > 0) { - bcopy(p, p + right, strlen(p) + 1); + memmove(p + right, p, strlen(p) + 1); p += right; } } @@ -5724,7 +5724,7 @@ Parse(char *buf, int bufl, char **args, int *argl) Msg(0, "%s: no space left for variable expansion.", rc_name); return 0; } - bcopy(v, pp, vl); + memmove(pp, v, vl); pp += vl; } continue; @@ -6693,7 +6693,7 @@ Colonfin(char *buf, int len, char *data) RcLine(buf, len); else { - bcopy(buf, mbuf, len); + memmove(mbuf, buf, len); RcLine(mbuf, sizeof mbuf); } } @@ -6999,7 +6999,7 @@ copy_reg_fn(char *buf, int len, char *data) Msg(0, "%s", strnomem); return; } - bcopy(D_user->u_plop.buf, pp->buf, D_user->u_plop.len); + memmove(pp->buf, D_user->u_plop.buf, D_user->u_plop.len); } pp->len = D_user->u_plop.len; pp->enc = D_user->u_plop.enc; diff --git a/src/resize.c b/src/resize.c index 94f2543..0e141af 100644 --- a/src/resize.c +++ b/src/resize.c @@ -415,42 +415,42 @@ BcopyMline(struct mline *mlf, int xf, struct mline *mlt, int xt, int l, int w) { int r = 0; - bcopy((char *)mlf->image + xf, (char *)mlt->image + xt, l); + memmove((char *)mlt->image + xt, (char *)mlf->image + xf, l); if (mlf->attr != null && mlt->attr == null) { if ((mlt->attr = (unsigned char *)calloc(w, 1)) == 0) mlt->attr = null, r = -1; } if (mlt->attr != null) - bcopy((char *)mlf->attr + xf, (char *)mlt->attr + xt, l); + memmove((char *)mlt->attr + xt, (char *)mlf->attr + xf, l); if (mlf->font != null && mlt->font == null) { if ((mlt->font = (unsigned char *)calloc(w, 1)) == 0) mlt->font = null, r = -1; } if (mlt->font != null) - bcopy((char *)mlf->font + xf, (char *)mlt->font + xt, l); + memmove((char *)mlt->font + xt, (char *)mlf->font + xf, l); if (mlf->fontx != null && mlt->fontx == null) { if ((mlt->fontx = (unsigned char *)calloc(w, 1)) == 0) mlt->fontx = null, r = -1; } if (mlt->fontx != null) - bcopy((char *)mlf->fontx + xf, (char *)mlt->fontx + xt, l); + memmove((char *)mlt->fontx + xt, (char *)mlf->font + xf, l); if (mlf->color != null && mlt->color == null) { if ((mlt->color = (unsigned char *)calloc(w, 1)) == 0) mlt->color = null, r = -1; } if (mlt->color != null) - bcopy((char *)mlf->color + xf, (char *)mlt->color + xt, l); + memmove((char *)mlt->color + xt, (char *)mlf->color + xf, l); if (mlf->colorx != null && mlt->colorx == null) { if ((mlt->colorx = (unsigned char *)calloc(w, 1)) == 0) mlt->colorx = null, r = -1; } if (mlt->colorx != null) - bcopy((char *)mlf->colorx + xf, (char *)mlt->colorx + xt, l); + memmove((char *)mlt->colorx + xt, (char *)mlf->colorx + xf, l); return r; } diff --git a/src/screen.c b/src/screen.c index ddd2b06..ef5e501 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2204,7 +2204,7 @@ backtick_fn(struct event *ev, char *data) if (bt->buf[k] == '\n') break; k++; - bcopy(bt->buf + k, bt->result, i - j - k); + memmove(bt->result, bt->buf + k, i - j - k); bt->result[i - j - k - 1] = 0; backtick_filter(bt); WindowChanged(0, '`'); @@ -2217,7 +2217,7 @@ backtick_fn(struct event *ev, char *data) if (j < l) { if (j) - bcopy(bt->buf + i - j, bt->buf, j); + memmove(bt->buf, bt->buf + i - j, j); i = j; } bt->bufi = i; @@ -2324,7 +2324,7 @@ runbacktick(struct backtick *bt, int *tickp, time_t now) } if (j < l) { - bcopy(bt->result + i - j, bt->result, j); + memmove(bt->result, bt->result + i - j, j); i = j; } } @@ -2775,7 +2775,7 @@ MakeWinMsgEv(char *str, struct win *win, int esc, int padlen, struct event *ev, if (left + lastpad > p - winmsg_buf) left = p - winmsg_buf - lastpad; if (p - winmsg_buf - lastpad - left > 0) - bcopy(winmsg_buf + lastpad + left, winmsg_buf + lastpad, p - winmsg_buf - lastpad - left); + memmove(winmsg_buf + lastpad, winmsg_buf + lastpad + left, p - winmsg_buf - lastpad - left); p -= left; r = winmsg_numrend; while (r && winmsg_rendpos[r - 1] > lastpad) diff --git a/src/socket.c b/src/socket.c index 52b4235..a02a109 100644 --- a/src/socket.c +++ b/src/socket.c @@ -969,7 +969,7 @@ ReceiveMsg() while(cl >= CMSG_LEN(sizeof(int))) { int passedfd; - bcopy(cp, &passedfd, sizeof(int)); + memmove(&passedfd, cp, sizeof(int)); if (recvfd >= 0 && passedfd != recvfd) close(recvfd); recvfd = passedfd; @@ -1703,7 +1703,7 @@ SendAttachMsg(int s, struct msg *m, int fd) cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN(sizeof(int)); - bcopy(&fd, CMSG_DATA(cmsg), sizeof(int)); + memmove(CMSG_DATA(cmsg), &fd, sizeof(int)); msg.msg_controllen = cmsg->cmsg_len; while(1) { diff --git a/src/termcap.c b/src/termcap.c index 6ae306e..fc43ecd 100644 --- a/src/termcap.c +++ b/src/termcap.c @@ -673,11 +673,11 @@ addmapseq(char *seq, int k, int nr) D_seqh = 0; evdeq(&D_mapev); if (j > 0) - bcopy((char *)p, (char *)p + 2 * k + 4, D_nseqs - i); + memmove((char *)p + 2 * k + 4, (char *)p, D_nseqs - i); p[0] = nr >> 8; p[1] = nr; p[2] = k; - bcopy(seq, (char *)p + 3, k); + memmove((char *)p + 3, seq, k); memset(p + k + 3, 0, k + 1); D_nseqs += 2 * k + 4; if (j > 0) @@ -737,7 +737,7 @@ remmapseq(char *seq, int k) } } if (D_kmaps + D_nseqs > p + 2 * k + 4) - bcopy((char *)p + 2 * k + 4, (char *)p, (D_kmaps + D_nseqs) - (p + 2 * k + 4)); + memmove((char *)p, (char *)p + 2 * k + 4, (D_kmaps + D_nseqs) - (p + 2 * k + 4)); D_nseqs -= 2 * k + 4; D_seqp = D_kmaps + 3; D_seql = 0; @@ -426,7 +426,7 @@ SetUtmp(struct win *win) memset((char *)&u, 0, sizeof(u)); if ((saved_ut = bcmp((char *) &win->w_savut, (char *)&u, sizeof(u)))) /* restore original, of which we will adopt all fields but ut_host */ - bcopy((char *)&win->w_savut, (char *) &u, sizeof(u)); + memmove((char *) &u, (char *)&win->w_savut, sizeof(u)); if (!saved_ut) makeuser(&u, stripdev(win->w_tty), LoginName, win->w_pid); @@ -484,7 +484,7 @@ SetUtmp(struct win *win) } debug("SetUtmp successful\n"); win->w_slot = slot; - bcopy((char *)&u, (char *)&win->w_savut, sizeof(u)); + memmove((char *)&win->w_savut, (char *)&u, sizeof(u)); UT_CLOSE; return 0; } @@ -511,7 +511,7 @@ RemoveUtmp(struct win *win) } memset((char *) &u, 0, sizeof(u)); #ifdef sgi - bcopy((char *)&win->w_savut, (char *)&u, sizeof(u)); + memmove((char *)&u, (char *)&win->w_savut, sizeof(u)); uu = &u; #else if ((uu = getutslot(slot)) == 0) @@ -519,7 +519,7 @@ RemoveUtmp(struct win *win) Msg(0, "Utmp slot not found -> not removed"); return -1; } - bcopy((char *)uu, (char *)&win->w_savut, sizeof(win->w_savut)); + memmove((char *)&win->w_savut, (char *)uu, sizeof(win->w_savut)); #endif u = *uu; makedead(&u); diff --git a/src/window.c b/src/window.c index c299e25..6d4f035 100644 --- a/src/window.c +++ b/src/window.c @@ -227,7 +227,7 @@ DoAutolf(char *buf, int *lenp, int fr) } if (len == 0) break; - bcopy(p, p + 1, len++); + memmove(p + 1, p, len++); p[1] = '\n'; } *lenp = p - buf; @@ -309,7 +309,7 @@ WinProcess(char **bufpp, int *lenp) #endif { l2 = l; - bcopy(*bufpp, ibuf + *ilen, l2); + memmove(ibuf + *ilen, *bufpp, l2); if (fore->w_autolf && (trunc = DoAutolf(ibuf + *ilen, &l2, f - l2))) l -= trunc; #ifdef BUILTIN_TELNET @@ -1311,8 +1311,8 @@ ForkWindow(struct win *win, char **args, char *ttyn) { if (strlen(NewEnv[2]) - (s2 - s1) + tl < 1024) { - bcopy(s2, s1 + tl, strlen(s2) + 1); - bcopy(win->w_term, s1, tl); + memmove(s1 + tl, s2, strlen(s2) + 1); + memmove(s1, win->w_term, tl); } } } @@ -1776,7 +1776,7 @@ win_readev_fn(struct event *ev, char *data) if (wtop) { debug("sending input to pwin\n"); - bcopy(bp, p->w_pwin->p_inbuf + p->w_pwin->p_inlen, len); + memmove(p->w_pwin->p_inbuf + p->w_pwin->p_inlen, bp, len); p->w_pwin->p_inlen += len; } @@ -1799,7 +1799,7 @@ win_writeev_fn(struct event *ev, char *data) if ((len = write(ev->fd, p->w_inbuf, p->w_inlen)) <= 0) len = p->w_inlen; /* dead window */ if ((p->w_inlen -= len)) - bcopy(p->w_inbuf + len, p->w_inbuf, p->w_inlen); + memmove(p->w_inbuf, p->w_inbuf + len, p->w_inlen); } if (p->w_paster.pa_pastelen && !p->w_slowpaste) { @@ -1868,7 +1868,7 @@ pseu_readev_fn(struct event *ev, char *data) /* no packet mode on pseudos! */ if (ptow) { - bcopy(buf, p->w_inbuf + p->w_inlen, len); + memmove(p->w_inbuf + p->w_inlen, buf, len); p->w_inlen += len; } WriteString(p, buf, len); @@ -1888,7 +1888,7 @@ pseu_writeev_fn(struct event *ev, char *data) if ((len = write(ev->fd, pw->p_inbuf, pw->p_inlen)) <= 0) len = pw->p_inlen; /* dead pseudo */ if ((p->w_pwin->p_inlen -= len)) - bcopy(p->w_pwin->p_inbuf + len, p->w_pwin->p_inbuf, p->w_pwin->p_inlen); + memmove(p->w_pwin->p_inbuf, p->w_pwin->p_inbuf + len, p->w_pwin->p_inlen); } |