From 37b7eb88f3141ce69b500a80b3f5f19715e73f89 Mon Sep 17 00:00:00 2001 From: Marius Tolzmann Date: Thu, 21 May 2015 13:21:57 +0200 Subject: [PATCH 1/2] mx_util: Fix missing dependencies in Makefile --- Makefile | 4 ++++ mx_util.c | 1 + 2 files changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 15a7de3..f209195 100644 --- a/Makefile +++ b/Makefile @@ -186,6 +186,7 @@ mxq_mysql.h += $(mxq_util.h) ### mxq_util.h --------------------------------------------------------- mxq_util.h += mxq_util.h +mxq_util.h += $(mx_log.h) mxq_util.h += $(mxq.h) ### mxq_group.h -------------------------------------------------------- @@ -221,6 +222,8 @@ clean: CLEAN += mx_log.o ### mx_util.o ---------------------------------------------------------- +mx_util.o: $(mx_log.h) + clean: CLEAN += mx_util.o ### mx_flock.o ------------------------------------------------------- @@ -427,6 +430,7 @@ test_mx_util.o: $(mx_util.h) clean: CLEAN += test_mx_util.o test_mx_util: mx_util.o +test_mx_util: mx_log.o clean: CLEAN += test_mx_util test: test_mx_util diff --git a/mx_util.c b/mx_util.c index 5befe06..da61176 100644 --- a/mx_util.c +++ b/mx_util.c @@ -13,6 +13,7 @@ //#include #include +#include "mx_log.h" #include "mx_util.h" static inline int _mx_strbeginswith(char *str, const char *start, char **endptr, short ignore_case) From ba454f1ef9131fcb45929a54e6b14076c0d42114 Mon Sep 17 00:00:00 2001 From: Marius Tolzmann Date: Thu, 21 May 2015 13:44:39 +0200 Subject: [PATCH 2/2] mx_mysql: minor cleanup --- mx_mysql.h | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/mx_mysql.h b/mx_mysql.h index d005895..02e8348 100644 --- a/mx_mysql.h +++ b/mx_mysql.h @@ -4,8 +4,6 @@ #include #include -//#include "mxq_util.h" - #include "mx_util.h" #ifdef MX_NDEBUG_MYSQL @@ -31,7 +29,6 @@ } \ } while (0) - struct mx_mysql { MYSQL *mysql; @@ -86,42 +83,6 @@ struct mx_mysql_stmt { struct mx_mysql_bind param; }; -/* -#include -static inline void mx_mysql_bind_string2(struct mx_mysql_bind *b, int index) -{ - assert(index < b->count); - b->bind[index].buffer_type = MYSQL_TYPE_STRING; - b->bind[index].buffer = 0; - b->bind[index].buffer_length = 0; - b->bind[index].length = &(b->length[index]); -} - -static inline void mx_mysql_bind_string3(struct mx_mysql_bind *b, int index, char *value) -{ - assert(index < b->count); - b->bind[index].buffer_type = MYSQL_TYPE_STRING; - b->bind[index].buffer = value; - b->bind[index].buffer_length = strlen(value); - b->bind[index].length = &(b->bind[index].buffer_length); -} - -#define MXQ_MYSQL_BIND_VARSTR(b, c, v) \ - do { \ - (b)[(c)].buffer_type = MYSQL_TYPE_STRING; \ - (b)[(c)].buffer = 0; \ - (b)[(c)].buffer_length = 0; \ - (b)[(c)].length = (v); \ - } while (0) - -#define MXQ_MYSQL_BIND_STRING(b, c, v) \ - do { \ - (b)[(c)].buffer_type = MYSQL_TYPE_STRING; \ - (b)[(c)].buffer = (v); \ - (b)[(c)].buffer_length = strlen((v)); \ - (b)[(c)].length = &((b)[(c)].buffer_length); \ - } while (0) -*/ #ifndef MX_MYSQL_FAIL_WAIT_DEFAULT # ifdef MX_CALLOC_FAIL_WAIT_DEFAULT # define MX_MYSQL_FAIL_WAIT_DEFAULT MX_CALLOC_FAIL_WAIT_DEFAULT @@ -168,7 +129,6 @@ int mx_mysql_statement_close(struct mx_mysql_stmt **stmt); #define mx_mysql_statement_param_bind(s, i, t, p) mx_mysql_bind_##t(&((s)->param), (i), (p)) -//int mx_mysql_bind_validate(struct mx_mysql_bind *b); int mx_mysql_bind_string(struct mx_mysql_bind *b, unsigned int index, char **value); int mx_mysql_bind_int8(struct mx_mysql_bind *b, unsigned int index, int8_t *value); @@ -181,6 +141,4 @@ int mx_mysql_bind_uint16(struct mx_mysql_bind *b, unsigned int index, uint16_t * int mx_mysql_bind_uint32(struct mx_mysql_bind *b, unsigned int index, uint32_t *value); int mx_mysql_bind_uint64(struct mx_mysql_bind *b, unsigned int index, uint64_t *value); - - #endif