Don't copy util functions in client.c

This requires moving croak() to logging.c and avoiding use
of log functions in util.c.
This commit is contained in:
Miroslav Lichvar
2009-09-15 18:08:58 +02:00
parent 19f3a6bca8
commit 5a2b38378c
7 changed files with 28 additions and 62 deletions

24
util.c
View File

@@ -31,7 +31,6 @@
#include "sysincl.h"
#include "util.h"
#include "logging.h"
/* ================================================== */
@@ -65,21 +64,14 @@ UTI_CompareTimevals(struct timeval *a, struct timeval *b)
} else if (a->tv_sec > b->tv_sec) {
return +1;
} else {
if (a->tv_sec != b->tv_sec) {
CROAK("a->tv_sec != b->tv_sec");
}
if (a->tv_usec < b->tv_usec) {
return -1;
} else if (a->tv_usec > b->tv_usec) {
return +1;
} else {
if (a->tv_usec != b->tv_usec) {
CROAK("a->tv_usec != b->tv_usec");
}
return 0;
}
}
CROAK("Impossible"); /* Shouldn't be able to fall through. */
}
/* ================================================== */
@@ -346,19 +338,3 @@ UTI_Int64ToTimeval(NTP_int64 *src,
}
/* ================================================== */
/* Force a core dump and exit without doing abort() or assert(0).
These do funny things with the call stack in the core file that is
generated, which makes diagnosis difficult. */
int
croak(const char *file, int line, const char *msg)
{
int a;
LOG(LOGS_ERR, LOGF_Util, "Unexpected condition [%s] at %s:%d, core dumped",
msg, file, line);
a = * (int *) 0;
return a; /* Can't happen - this stops the optimiser optimising the
line above */
}
/* ================================================== */