Skip to content

Commit

Permalink
Merge branch 'master' into mx_mysql
Browse files Browse the repository at this point in the history
* master:
  mx_util: Fix missing dependencies in Makefile
  mx_util: Assertion loglevel increased to emergency
  mxqsub: Add --verbose option
  mxqsub: Handle unrecognized options better
  mxqsub: Improve user input verification
  mx_util: Remove unused variables
  mxqsub: User mx_mysql functions and remove mxq_mysql support
  mxqsub: Remove unused -D option (Fixes memory leak)
  mx_util: Add mx_calloc*()
  • Loading branch information
mariux committed May 21, 2015
2 parents 97e1062 + 742e873 commit 58398b4
Show file tree
Hide file tree
Showing 4 changed files with 274 additions and 257 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,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 @@ -226,6 +227,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 @@ -343,6 +346,7 @@ mxqsub.o: $(mxq_util.h)
mxqsub.o: $(mx_util.h)
mxqsub.o: $(mx_log.h)
mxqsub.o: $(mxq_mysql.h)
mxqsub.o: $(mx_mysql.h)
mxqsub.o: CFLAGS += $(CFLAGS_MYSQL)
mxqsub.o: CFLAGS += $(CFLAGS_MXQ_MYSQL_DEFAULT_FILE)

Expand Down Expand Up @@ -377,6 +381,7 @@ mxqsub: mxq_mysql.o
mxqsub: mxq_util.o
mxqsub: mx_util.o
mxqsub: mx_log.o
mxqsub: mx_mysql.o
mxqsub: LDLIBS += $(LDLIBS_MYSQL)

build: mxqsub
Expand Down Expand Up @@ -442,6 +447,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
11 changes: 1 addition & 10 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 Expand Up @@ -205,7 +206,6 @@ inline int mx_strtoll(char *str, signed long long int *to)
int mx_strtoui(char *str, unsigned int *to)
{
unsigned long int ul;
char *end;
int res;

assert(str);
Expand All @@ -226,7 +226,6 @@ int mx_strtoui(char *str, unsigned int *to)
int mx_strtou8(char *str, uint8_t *to)
{
unsigned long int ul;
char *end;
int res;

assert(str);
Expand All @@ -247,7 +246,6 @@ int mx_strtou8(char *str, uint8_t *to)
int mx_strtou16(char *str, uint16_t *to)
{
unsigned long int ul;
char *end;
int res;

assert(str);
Expand All @@ -268,7 +266,6 @@ int mx_strtou16(char *str, uint16_t *to)
int mx_strtou32(char *str, uint32_t *to)
{
unsigned long int ul;
char *end;
int res;

assert(str);
Expand All @@ -289,7 +286,6 @@ int mx_strtou32(char *str, uint32_t *to)
int mx_strtou64(char *str, uint64_t *to)
{
unsigned long long int ull;
char *end;
int res;

assert(str);
Expand All @@ -312,7 +308,6 @@ int mx_strtou64(char *str, uint64_t *to)
int mx_strtoi(char *str, signed int *to)
{
signed long int l;
char *end;
int res;

assert(str);
Expand All @@ -333,7 +328,6 @@ int mx_strtoi(char *str, signed int *to)
int mx_strtoi8(char *str, int8_t *to)
{
signed long int l;
char *end;
int res;

assert(str);
Expand All @@ -354,7 +348,6 @@ int mx_strtoi8(char *str, int8_t *to)
int mx_strtoi16(char *str, int16_t *to)
{
signed long int l;
char *end;
int res;

assert(str);
Expand All @@ -375,7 +368,6 @@ int mx_strtoi16(char *str, int16_t *to)
int mx_strtoi32(char *str, int32_t *to)
{
signed long int l;
char *end;
int res;

assert(str);
Expand All @@ -396,7 +388,6 @@ int mx_strtoi32(char *str, int32_t *to)
int mx_strtoi64(char *str, int64_t *to)
{
signed long long int ll;
char *end;
int res;

assert(str);
Expand Down
4 changes: 2 additions & 2 deletions mx_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
do {\
if (!(test)) {\
errno=(eno);\
mx_log_debug("Assertion '" #test "' failed. Returning -(errno=" #eno ") [%d]: %m", -errno);\
mx_log_emerg("Assertion '" #test "' failed. Returning -(errno=" #eno ") [%d]: %m", -errno);\
return -errno;\
}\
} while (0)
Expand All @@ -27,7 +27,7 @@
do {\
if (!(test)) {\
errno=(eno);\
mx_log_debug("Assertion '" #test "' failed. Setting errno=" #eno " [%d] and returning NULL: %m", errno);\
mx_log_emerg("Assertion '" #test "' failed. Setting errno=" #eno " [%d] and returning NULL: %m", errno);\
return NULL;\
}\
} while (0)
Expand Down
Loading

0 comments on commit 58398b4

Please sign in to comment.