mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 22:55:06 -05:00
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:
24
util.c
24
util.c
@@ -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 */
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
Reference in New Issue
Block a user