diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-11-01 22:53:21 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-11-01 22:53:21 +0800 |
commit | 8d4ea289db478f23708c0338e043467c0ad65eee (patch) | |
tree | 4f78a7ae4f20f66e2c63abb7c4754e900da854fa /mbbsd/read.c | |
parent | 4dc29aafe3881ac0a1170ebfb04071bf821c7eff (diff) | |
download | pttbbs-8d4ea289db478f23708c0338e043467c0ad65eee.tar pttbbs-8d4ea289db478f23708c0338e043467c0ad65eee.tar.gz pttbbs-8d4ea289db478f23708c0338e043467c0ad65eee.tar.bz2 pttbbs-8d4ea289db478f23708c0338e043467c0ad65eee.tar.lz pttbbs-8d4ea289db478f23708c0338e043467c0ad65eee.tar.xz pttbbs-8d4ea289db478f23708c0338e043467c0ad65eee.tar.zst pttbbs-8d4ea289db478f23708c0338e043467c0ad65eee.zip |
use memmove instead of memcpy if overlapping
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2303 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/read.c')
-rw-r--r-- | mbbsd/read.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mbbsd/read.c b/mbbsd/read.c index a54aa614..5350277d 100644 --- a/mbbsd/read.c +++ b/mbbsd/read.c @@ -18,7 +18,7 @@ UnTagger(int locus) TagNum--; if (TagNum > locus) - memcpy(&TagList[locus], &TagList[locus + 1], + memmove(&TagList[locus], &TagList[locus + 1], (TagNum - locus) * sizeof(TagItem)); } @@ -50,11 +50,12 @@ Tagger(time_t chrono, int recno, int mode) return NA; TagNum--; - memcpy(&TagList[posi], &TagList[posi + 1], + memmove(&TagList[posi], &TagList[posi + 1], (TagNum - posi) * sizeof(TagItem)); } else if (TagNum < MAXTAGS) { TagItem *tagp, buf[MAXTAGS]; + /* TODO memmove 即可, 不用另開 buf[] 再 memcpy 兩次 */ tail = (TagNum - head) * sizeof(TagItem); tagp = &TagList[head]; memcpy(buf, tagp, tail); @@ -194,6 +195,7 @@ getkeep(char *s, int def_topline, int def_cursline) { static struct keeploc_t *keeplist = NULL; struct keeploc_t *p; + /* TODO board 存 bid, 其他存 hash, 不要 strdup */ if (def_cursline >= 0) for (p = keeplist; p; p = p->next) { |