From 83b2e0b3ceda907b7186acfcc56c214fc04d9c13 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Thu, 7 Feb 2013 19:38:32 -0800 Subject: Remove some macros --- src/tool/eathena-monitor.cpp | 50 +++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) (limited to 'src/tool') 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); -- cgit v1.2.3-60-g2f50