summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-01-14 19:19:39 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-01-14 19:19:39 +0800
commitfc286d42f7190df00fbb2d394e4c860a4ab5a28b (patch)
treeebc7213a8f27a425c3dfea78f68cf09b57cd1918
parenta1a87e0830f83020fd69d4e44a4db85ed2309191 (diff)
downloadpttbbs-fc286d42f7190df00fbb2d394e4c860a4ab5a28b.tar
pttbbs-fc286d42f7190df00fbb2d394e4c860a4ab5a28b.tar.gz
pttbbs-fc286d42f7190df00fbb2d394e4c860a4ab5a28b.tar.bz2
pttbbs-fc286d42f7190df00fbb2d394e4c860a4ab5a28b.tar.lz
pttbbs-fc286d42f7190df00fbb2d394e4c860a4ab5a28b.tar.xz
pttbbs-fc286d42f7190df00fbb2d394e4c860a4ab5a28b.tar.zst
pttbbs-fc286d42f7190df00fbb2d394e4c860a4ab5a28b.zip
saving stack usage by reducing function call
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@597 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/mbbsd.c28
-rw-r--r--mbbsd/talk.c4
2 files changed, 14 insertions, 18 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 9cfb91d2..521673c5 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1,4 +1,4 @@
-/* $Id: mbbsd.c,v 1.60 2002/12/10 11:59:02 in2 Exp $ */
+/* $Id: mbbsd.c,v 1.61 2003/01/14 11:19:39 in2 Exp $ */
#include "bbs.h"
#define SOCKET_QLEN 4
@@ -916,7 +916,7 @@ do_term_init()
raise(SIGWINCH);
}
-static void
+inline static void
start_client()
{
#ifdef CPULIMIT
@@ -1161,8 +1161,8 @@ bind_port(int port)
/*******************************************************/
-static void shell_login(int argc, char *argv[], char *envp[]);
-static void daemon_login(int argc, char *argv[], char *envp[]);
+static int shell_login(int argc, char *argv[], char *envp[]);
+static int daemon_login(int argc, char *argv[], char *envp[]);
static int check_ban_and_load(int fd);
int
@@ -1177,17 +1177,15 @@ main(int argc, char *argv[], char *envp[])
signal(SIGUSR1, SIG_IGN);
signal(SIGUSR2, SIG_IGN);
- /* check if invoked as "bbs" */
attach_SHM();
- if (argc == 3)
- shell_login(argc, argv, envp);
- else
- daemon_login(argc, argv, envp);
+ if( (argc == 3 && shell_login(argc, argv, envp)) ||
+ (argc != 3 && daemon_login(argc, argv, envp)) )
+ start_client();
return 0;
}
-static void
+static int
shell_login(int argc, char *argv[], char *envp[])
{
@@ -1214,12 +1212,12 @@ shell_login(int argc, char *argv[], char *envp[])
init_tty();
if (check_ban_and_load(0)) {
- exit(0);
+ return 0;
}
- start_client();
+ return 1;
}
-static void
+static int
daemon_login(int argc, char *argv[], char *envp[])
{
int msock, csock; /* socket for Master and Child */
@@ -1296,9 +1294,7 @@ daemon_login(int argc, char *argv[], char *envp[])
getremotename(&xsin, fromhost, remoteusername);
telnet_init();
- start_client();
- close(0);
- close(1);
+ return 1;
}
/*
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index c7f6e7a7..6909d726 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1,4 +1,4 @@
-/* $Id: talk.c,v 1.97 2002/12/31 17:40:51 in2 Exp $ */
+/* $Id: talk.c,v 1.98 2003/01/14 11:19:39 in2 Exp $ */
#include "bbs.h"
#define QCAST int (*)(const void *, const void *)
@@ -1772,7 +1772,7 @@ call_in(userinfo_t * uentp, int fri_stat)
return 0;
}
-static void
+inline static void
userlist(void)
{
/*