summaryrefslogtreecommitdiffstats
path: root/mbbsd/talk.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-09-17 02:46:36 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-09-17 02:46:36 +0800
commite72482234de3aaca436c044b69e57a30202a7211 (patch)
tree7e1b259ee313a50c8be21b17b228c31c495757fb /mbbsd/talk.c
parentcaddbcd9c4cf54cc685c43b5d7d05f748532f422 (diff)
downloadpttbbs-e72482234de3aaca436c044b69e57a30202a7211.tar
pttbbs-e72482234de3aaca436c044b69e57a30202a7211.tar.gz
pttbbs-e72482234de3aaca436c044b69e57a30202a7211.tar.bz2
pttbbs-e72482234de3aaca436c044b69e57a30202a7211.tar.lz
pttbbs-e72482234de3aaca436c044b69e57a30202a7211.tar.xz
pttbbs-e72482234de3aaca436c044b69e57a30202a7211.tar.zst
pttbbs-e72482234de3aaca436c044b69e57a30202a7211.zip
Allocate water[] on demend. Saved about 4400 bytes.
Only 4%~5% online user of ptt use this feature. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3420 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/talk.c')
-rw-r--r--mbbsd/talk.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 408c9ac8..28accbf0 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -531,6 +531,17 @@ my_query(const char *uident)
static char t_last_write[80];
+void check_water_init(void)
+{
+ if(water==NULL) {
+ water = (water_t*)malloc(sizeof(water_t)*6);
+ memset(water, 0, sizeof(water_t)*6);
+ water_which = &water[0];
+
+ strlcpy(water[0].userid, " ¥þ³¡ ", sizeof(water[0].userid));
+ }
+}
+
static void
water_scr(const water_t * tw, int which, char type)
{
@@ -590,6 +601,7 @@ my_write2(void)
water_t *tw;
unsigned char mode0;
+ check_water_init();
if (swater[0] == NULL)
return;
wmofo = REPLYING;
@@ -727,6 +739,7 @@ my_write(pid_t pid, const char *prompt, const char *id, int flag, userinfo_t * p
userinfo_t *uin;
uin = (puin != NULL) ? puin : (userinfo_t *) search_ulist_pid(pid);
strlcpy(destid, id, sizeof(destid));
+ check_water_init();
/* what if uin is NULL but other conditions are not true?
* will this situation cause SEGV?
@@ -976,6 +989,7 @@ t_display_new(void)
else
t_display_new_flag = 1;
+ check_water_init();
if (WATERMODE(WATER_ORIG))
water_which = &water[0];
else