Fix prototypes and unused variables

This commit is contained in:
Rodrigo Arias 2021-10-18 12:44:43 +02:00
parent 55ae07403c
commit c2f7085e11
3 changed files with 37 additions and 37 deletions

40
dump.c
View File

@ -12,25 +12,25 @@
#include "ovni_trace.h" #include "ovni_trace.h"
#include "emu.h" #include "emu.h"
//static void
//hexdump(uint8_t *buf, size_t size)
//{
// size_t i, j;
//
// //printf("writing %ld bytes in cpu=%d\n", size, rthread.cpu);
//
// for(i=0; i<size; i+=16)
// {
// for(j=0; j<16 && i+j < size; j++)
// {
// fprintf(stderr, "%02x ", buf[i+j]);
// }
// fprintf(stderr, "\n");
// }
//}
static void static void
hexdump(uint8_t *buf, size_t size) emit(struct ovni_stream *stream, struct ovni_ev *ev)
{
int i, j;
//printf("writing %ld bytes in cpu=%d\n", size, rthread.cpu);
for(i=0; i<size; i+=16)
{
for(j=0; j<16 && i+j < size; j++)
{
fprintf(stderr, "%02x ", buf[i+j]);
}
fprintf(stderr, "\n");
}
}
void emit(struct ovni_stream *stream, struct ovni_ev *ev)
{ {
int64_t delta; int64_t delta;
uint64_t clock; uint64_t clock;
@ -58,9 +58,11 @@ void emit(struct ovni_stream *stream, struct ovni_ev *ev)
} }
void dump_events(struct ovni_trace *trace) static void
dump_events(struct ovni_trace *trace)
{ {
int i, f; size_t i;
ssize_t f;
uint64_t minclock, lastclock; uint64_t minclock, lastclock;
struct ovni_ev *ev; struct ovni_ev *ev;
struct ovni_stream *stream; struct ovni_stream *stream;

View File

@ -84,8 +84,8 @@ cmp_double(const void *pa, const void *pb)
return 0; return 0;
} }
void static void
usage(int argc, char *argv[]) usage(void)
{ {
fprintf(stderr, "%s: clock synchronization utility\n", progname); fprintf(stderr, "%s: clock synchronization utility\n", progname);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
@ -94,7 +94,7 @@ usage(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
void static void
parse_options(struct options *options, int argc, char *argv[]) parse_options(struct options *options, int argc, char *argv[])
{ {
int opt; int opt;
@ -120,7 +120,7 @@ parse_options(struct options *options, int argc, char *argv[])
options->nsamples = atoi(optarg); options->nsamples = atoi(optarg);
break; break;
default: /* '?' */ default: /* '?' */
usage(argc, argv); usage();
} }
} }
@ -131,7 +131,7 @@ parse_options(struct options *options, int argc, char *argv[])
} }
} }
void static void
get_clock_samples(struct offset *offset, int nsamples) get_clock_samples(struct offset *offset, int nsamples)
{ {
int i; int i;
@ -150,7 +150,7 @@ get_clock_samples(struct offset *offset, int nsamples)
offset->wall_t1 = get_time(CLOCK_REALTIME, 0); offset->wall_t1 = get_time(CLOCK_REALTIME, 0);
} }
void static void
fill_offset(struct offset *offset, int nsamples) fill_offset(struct offset *offset, int nsamples)
{ {
int warmup_nsamples; int warmup_nsamples;
@ -174,7 +174,7 @@ fill_offset(struct offset *offset, int nsamples)
get_clock_samples(offset, nsamples); get_clock_samples(offset, nsamples);
} }
void static void
offset_compute_delta(struct offset *ref, struct offset *cur, int nsamples, int verbose) offset_compute_delta(struct offset *ref, struct offset *cur, int nsamples, int verbose)
{ {
int i; int i;
@ -222,13 +222,13 @@ offset_compute_delta(struct offset *ref, struct offset *cur, int nsamples, int v
free(delta); free(delta);
} }
size_t static size_t
offset_size(int nsamples) offset_size(int nsamples)
{ {
return sizeof(struct offset) + sizeof(double) * nsamples; return sizeof(struct offset) + sizeof(double) * nsamples;
} }
struct offset * static struct offset *
table_get_offset(struct offset_table *table, int i, int nsamples) table_get_offset(struct offset_table *table, int i, int nsamples)
{ {
char *p; char *p;
@ -239,7 +239,7 @@ table_get_offset(struct offset_table *table, int i, int nsamples)
return (struct offset *) p; return (struct offset *) p;
} }
struct offset_table * static struct offset_table *
build_offset_table(int nsamples, int rank, int verbose) build_offset_table(int nsamples, int rank, int verbose)
{ {
int i; int i;
@ -323,7 +323,7 @@ build_offset_table(int nsamples, int rank, int verbose)
return table; return table;
} }
void static void
print_drift_header(struct offset_table *table) print_drift_header(struct offset_table *table)
{ {
int i; int i;
@ -340,11 +340,10 @@ print_drift_header(struct offset_table *table)
printf("\n"); printf("\n");
} }
void static void
print_drift_row(struct offset_table *table) print_drift_row(struct offset_table *table)
{ {
int i; int i;
char buf[64];
printf("%-20f", table->offset[0]->wall_t1); printf("%-20f", table->offset[0]->wall_t1);
@ -354,7 +353,7 @@ print_drift_row(struct offset_table *table)
printf("\n"); printf("\n");
} }
void static void
print_table_detailed(struct offset_table *table) print_table_detailed(struct offset_table *table)
{ {
int i; int i;
@ -370,7 +369,7 @@ print_table_detailed(struct offset_table *table)
} }
} }
void static void
do_work(struct options *options, int rank) do_work(struct options *options, int rank)
{ {
int drift_mode; int drift_mode;

View File

@ -17,10 +17,9 @@
#endif #endif
static inline void static inline void
init() init(void)
{ {
char hostname[HOST_NAME_MAX]; char hostname[HOST_NAME_MAX];
char *appid;
if(gethostname(hostname, HOST_NAME_MAX) != 0) if(gethostname(hostname, HOST_NAME_MAX) != 0)
{ {
@ -38,7 +37,7 @@ int main(int argc, char *argv[])
struct ovni_ev ev = {0}; struct ovni_ev ev = {0};
int i, n; int i, n;
if(argv[1] != NULL) if(argc > 1)
n = atoi(argv[1]); n = atoi(argv[1]);
else else
n = 1000; n = 1000;