Skip to content

Commit

Permalink
Merge branch 'improvements'
Browse files Browse the repository at this point in the history
* improvements:
  Makefile: Build and run tests by default
  mx_log: Fix typo "ALERT"
  mxq_log: Use mx_streq()
  • Loading branch information
mariux committed Oct 26, 2015
2 parents c67084b + e345231 commit 05bd9d9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ manpages/%: manpages/%.xml
.PHONY: all
.PHONY: build

all: build
all: build test

.PHONY: devel
devel: CFLAGS += -DMXQ_DEVELOPMENT
Expand Down
2 changes: 1 addition & 1 deletion mx_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static int log_log(int level, int loglevel, char *file, unsigned long line, cons
prefix = "EMERGENCY: ";
break;
case MX_LOG_ALERT:
prefix = "AKERT: ";
prefix = "ALERT: ";
break;
case MX_LOG_CRIT:
prefix = "CRITCAL ERROR: ";
Expand Down
6 changes: 3 additions & 3 deletions mxq_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <unistd.h>

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

#ifndef mx_free_null
#include <stdlib.h>
#define mx_free_null(a) do { free((a)); (a) = NULL; } while(0)
Expand Down Expand Up @@ -42,7 +44,6 @@ static int timetag(char *buf, size_t size)

int mx_log_print(char *msg, size_t len)
{
int res;
char timebuf[1024];

static char *lastmsg = NULL;
Expand All @@ -61,8 +62,7 @@ int mx_log_print(char *msg, size_t len)
return -(errno=EINVAL);

if (lastmsg && lastlen == len) {
res = strcmp(msg, lastmsg);
if (res == 0) {
if (mx_streq(msg, lastmsg)) {
cnt++;
mx_free_null(msg);
return 2;
Expand Down

0 comments on commit 05bd9d9

Please sign in to comment.