diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-11-06 06:09:09 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-11-06 06:09:09 +0800 |
commit | 761f24e6af4c4691bcc0bcabba0197c0426d233d (patch) | |
tree | f0951ec853524f391fdc7785f11744ea42c13212 /mbbsd/screen.c | |
parent | 0e4f3ac7f8a565f8aebf8a337f648a36d3ab86fe (diff) | |
download | pttbbs-761f24e6af4c4691bcc0bcabba0197c0426d233d.tar pttbbs-761f24e6af4c4691bcc0bcabba0197c0426d233d.tar.gz pttbbs-761f24e6af4c4691bcc0bcabba0197c0426d233d.tar.bz2 pttbbs-761f24e6af4c4691bcc0bcabba0197c0426d233d.tar.lz pttbbs-761f24e6af4c4691bcc0bcabba0197c0426d233d.tar.xz pttbbs-761f24e6af4c4691bcc0bcabba0197c0426d233d.tar.zst pttbbs-761f24e6af4c4691bcc0bcabba0197c0426d233d.zip |
Backup screen without hole. Save 8~11kb for normal user.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2314 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/screen.c')
-rw-r--r-- | mbbsd/screen.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/mbbsd/screen.c b/mbbsd/screen.c index 6ad8920b..a58be429 100644 --- a/mbbsd/screen.c +++ b/mbbsd/screen.c @@ -452,3 +452,36 @@ standend() slp->eso = MAX(slp->eso, cur_col); } } + +void screen_backup(int len, screenline_t *bp, void *buf) +{ + int i; + size_t offset=0; + for(i=0;i<len;i++) { + memcpy((char*)buf+offset, &bp[i], ((char*)&bp[i].data-(char*)&bp[i])); + offset+=((char*)&bp[i].data-(char*)&bp[i]); + memcpy((char*)buf+offset, &bp[i].data, bp[i].len); + offset+=bp[i].len; + } +} + +size_t screen_backupsize(int len, screenline_t *bp) +{ + int i; + size_t sum=0; + for(i=0;i<len;i++) + sum+=((char*)&bp[i].data-(char*)&bp[i]) + bp[i].len; + return sum; +} + +void screen_restore(int len, screenline_t *bp, void *buf) +{ + int i; + size_t offset=0; + for(i=0;i<len;i++) { + memcpy(&bp[i], (char*)buf+offset, ((char*)&bp[i].data-(char*)&bp[i])); + offset+=((char*)&bp[i].data-(char*)&bp[i]); + memcpy(&bp[i].data, (char*)buf+offset, bp[i].len); + offset+=bp[i].len; + } +} |