Skip to content

Commit

Permalink
Merge branch 'master' into mxqsub
Browse files Browse the repository at this point in the history
* master:
  mx_mysql: minor cleanup
  mx_util: Fix missing dependencies in Makefile
  • Loading branch information
mariux committed May 21, 2015
2 parents c225c25 + 238bf36 commit 3d79c8f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 42 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,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 --------------------------------------------------------
Expand Down Expand Up @@ -229,6 +230,8 @@ clean: CLEAN += mx_log.o

### mx_util.o ----------------------------------------------------------

mx_util.o: $(mx_log.h)

clean: CLEAN += mx_util.o

### mx_flock.o -------------------------------------------------------
Expand Down Expand Up @@ -448,6 +451,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
Expand Down
42 changes: 0 additions & 42 deletions mx_mysql.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include <sys/resource.h>
#include <mysql.h>

//#include "mxq_util.h"

#include "mx_util.h"

#ifdef MX_NDEBUG_MYSQL
Expand All @@ -31,7 +29,6 @@
} \
} while (0)


struct mx_mysql {
MYSQL *mysql;

Expand Down Expand Up @@ -86,42 +83,6 @@ struct mx_mysql_stmt {
struct mx_mysql_bind param;
};

/*
#include <string.h>
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
Expand Down Expand Up @@ -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);
Expand All @@ -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
1 change: 1 addition & 0 deletions mx_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
//#include <sys/stat.h>
#include <fcntl.h>

#include "mx_log.h"
#include "mx_util.h"

static inline int _mx_strbeginswith(char *str, const char *start, char **endptr, short ignore_case)
Expand Down

0 comments on commit 3d79c8f

Please sign in to comment.