summaryrefslogtreecommitdiff
path: root/src/tool
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-02-07 19:38:32 -0800
committerBen Longbons <b.r.longbons@gmail.com>2013-02-07 22:41:23 -0800
commit83b2e0b3ceda907b7186acfcc56c214fc04d9c13 (patch)
treef4dcc8d8b59fd9a633bc2604cc92f0523cc76ee4 /src/tool
parentc67c2b7435a13d7ce17b2075e22dc5c6036f702a (diff)
downloadtmwa-83b2e0b3ceda907b7186acfcc56c214fc04d9c13.tar.gz
tmwa-83b2e0b3ceda907b7186acfcc56c214fc04d9c13.tar.bz2
tmwa-83b2e0b3ceda907b7186acfcc56c214fc04d9c13.tar.xz
tmwa-83b2e0b3ceda907b7186acfcc56c214fc04d9c13.zip
Remove some macros
Diffstat (limited to 'src/tool')
-rw-r--r--src/tool/eathena-monitor.cpp50
1 files changed, 22 insertions, 28 deletions
diff --git a/src/tool/eathena-monitor.cpp b/src/tool/eathena-monitor.cpp
index 2d12312..0a07d3b 100644
--- a/src/tool/eathena-monitor.cpp
+++ b/src/tool/eathena-monitor.cpp
@@ -21,7 +21,6 @@
#include "../poison.hpp"
-#define HOME getenv("HOME")
#define LOGIN_SERVER "./login-server"
#define MAP_SERVER "./map-server"
#define CHAR_SERVER "./char-server"
@@ -29,42 +28,37 @@
#define LOGFILE "log/eathena-monitor.log"
-#define SKIP_BLANK(ptr) ptr += skip_blank(ptr)
static
-size_t skip_blank(const char* ptr) {
- size_t i = 0;
+void SKIP_BLANK(char *& ptr)
+{
while (
- (ptr[i] == ' ') ||
- (ptr[i] == '\b') ||
- (ptr[i] == '\n') ||
- (ptr[i] == '\r')
- ) ptr++;
- return i;
+ (*ptr == ' ') ||
+ (*ptr == '\b') ||
+ (*ptr == '\n') ||
+ (*ptr == '\r')
+ )
+ ptr++;
}
-#define GOTO_EQL(ptr) ptr += goto_eql(ptr)
static
-size_t goto_eql(const char* ptr) {
- size_t i = 0;
+void GOTO_EQL(char *& ptr) {
while (
- (ptr[i] != '\0') &&
- (ptr[i] != '=') &&
- (ptr[i] != '\n') &&
- (ptr[i] != '\r')
- ) ptr++;
- return i;
+ (*ptr != '\0') &&
+ (*ptr != '=') &&
+ (*ptr != '\n') &&
+ (*ptr != '\r')
+ )
+ ptr++;
}
-#define GOTO_EOL(ptr) ptr += goto_newline(ptr)
static
-size_t goto_newline(const char* ptr) {
- size_t i = 0;
+void GOTO_EOL(char *& ptr) {
while (
- (ptr[i] != '\0') &&
- (ptr[i] != '\n') &&
- (ptr[i] != '\r')
- ) ptr++;
- return i;
+ (*ptr != '\0') &&
+ (*ptr != '\n') &&
+ (*ptr != '\r')
+ )
+ ptr++;
}
// initialiized to $HOME/tmwserver
@@ -192,7 +186,7 @@ int main(int argc, char *argv[]) {
signal(SIGQUIT, stop_process);
signal(SIGABRT, stop_process);
- workdir = make_path(HOME, "tmwserver");
+ workdir = make_path(getenv("HOME"), "tmwserver");
read_config(argc>1 ? argv[1] : NULL);