From: John Hodge Date: Sun, 20 Feb 2011 10:50:02 +0000 (+0800) Subject: Fixed segfault in coke code, diabled debug X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=a7691dbca0e1854d56992be5fed41bbb60543f15;p=tpg%2Fopendispense2.git Fixed segfault in coke code, diabled debug --- diff --git a/src/cokebank_sqlite/main.c b/src/cokebank_sqlite/main.c index 6165107..275d551 100644 --- a/src/cokebank_sqlite/main.c +++ b/src/cokebank_sqlite/main.c @@ -15,7 +15,7 @@ #include "../cokebank.h" #include -#define DEBUG 1 +#define DEBUG 0 const char * const csBank_DatabaseSetup = "CREATE TABLE IF NOT EXISTS accounts (" diff --git a/src/server/handler_coke.c b/src/server/handler_coke.c index da29580..f7d27b6 100644 --- a/src/server/handler_coke.c +++ b/src/server/handler_coke.c @@ -21,7 +21,7 @@ #include #define READ_TIMEOUT 2 // 2 seconds for ReadChar -#define TRACE_COKE 1 +#define TRACE_COKE 0 // === IMPORTS === @@ -51,6 +51,8 @@ pthread_mutex_t gCoke_Mutex = PTHREAD_MUTEX_INITIALIZER; // == CODE === int Coke_InitHandler() { + CompileRegex(&gCoke_StatusRegex, "^slot\\s+([0-9]+)\\s+([^:]+):([a-zA-Z]+)\\s*", REG_EXTENDED); + printf("connecting to coke machine...\n"); giCoke_SerialFD = InitSerial(gsCoke_SerialPort, 9600); @@ -82,7 +84,6 @@ int Coke_InitHandler() AddPeriodicFunction(Coke_int_UpdateSlotStatuses); - CompileRegex(&gCoke_StatusRegex, "^slot\\s+([0-9]+)\\s+([^:]+):([a-zA-Z]+)\\s*", REG_EXTENDED); return 0; } diff --git a/src/server/server.c b/src/server/server.c index 7106e52..5686ab7 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -1221,7 +1221,6 @@ int Server_int_ParseArgs(int bUseLongLast, char *ArgStr, ...) while( (dest = va_arg(args, char **)) ) { - printf(" dest = %p\n", dest); // Trim leading spaces while( *ArgStr == ' ' || *ArgStr == '\t' ) ArgStr ++;