Fix a bunch of trivial whitespace mistakes and update the miniobj.h

file before the real work starts.
This commit is contained in:
Poul-Henning Kamp 2011-02-25 09:40:17 +00:00
parent d25b0b98bc
commit fb4f617201
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=219027
9 changed files with 38 additions and 30 deletions

View File

@ -78,11 +78,11 @@ main(int argc, char * const *argv)
}
argc -= optind;
argv += optind;
if (argc != 1)
if (argc != 1)
usage();
if (size != 0 && reccnt != 0 && recsize != 0) { /* N N N */
if (size != reccnt * recsize)
if (size != reccnt * recsize)
errx(1, "Inconsistent -l, -r and -s values");
} else if (size != 0 && reccnt != 0 && recsize == 0) { /* N N Z */
if (size % reccnt)

View File

@ -156,7 +156,7 @@ main(int argc, char * const *argv)
errx(1, "Begin time not before End time");
fl = fifolog_reader_open(argv[0]);
if (!strcmp(opt_o, "-"))
fo = stdout;
else {

View File

@ -76,7 +76,7 @@ main(int argc, char * const *argv)
}
argc -= optind;
argv += optind;
if (argc != 1)
if (argc != 1)
usage();
if (z_opt > 9)

View File

@ -68,7 +68,7 @@
* present in these records as well:
* 5 32be time_t containing POSIX's understanding of UTC.
*
* These fields are immediately followed by the inner layer payload as
* These fields are immediately followed by the inner layer payload as
* described below, which has variable length.
*
* If the inner layer payload is shorter than the available space in
@ -95,10 +95,10 @@
*
* The inner layer:
* ----------------
* The inner layer contains data identification and to the second
* timestamping (the timestamp in the outer layer only marks the
* The inner layer contains data identification and to the second
* timestamping (the timestamp in the outer layer only marks the
* first possible timestamp for content in the SYNC record).
*
*
* offset type contents
* --------------------------------------------------------------
* 0 32be ident

View File

@ -91,7 +91,7 @@ fifolog_create(const char *fn, off_t size, unsigned recsize)
if (size == 0 && S_ISREG(st.st_mode))
size = st.st_size;
if (size == 0)
if (size == 0)
size = recsize * (off_t)(24*60*60);
if (S_ISREG(st.st_mode) && ftruncate(fd, size) < 0)

View File

@ -66,7 +66,7 @@ fifo_zfree(voidpf opaque __unused, voidpf address)
* Return value is NULL for success or a error description string to
* be augmented by errno if non-zero.
*
* The second function is just an error-handling wrapper around the
* The second function is just an error-handling wrapper around the
* first which, does the actual work.
*/
@ -88,7 +88,7 @@ fifolog_int_open_i(struct fifolog_file *f, const char *fname, int mode)
if (i != 0) {
i = fstat(f->fd, &st);
if (!S_ISREG(st.st_mode))
if (!S_ISREG(st.st_mode))
return ("Neither disk nor regular file");
f->recsize = 512;
f->logsize = st.st_size;

View File

@ -48,7 +48,7 @@ struct fifolog_reader {
#define FIFOLOG_READER_MAGIC 0x1036d139
struct fifolog_file *ff;
unsigned olen;
unsigned char *obuf;
unsigned char *obuf;
time_t now;
};
@ -75,7 +75,7 @@ fifolog_reader_open(const char *fname)
i = inflateInit(fr->ff->zs);
assert(i == Z_OK);
fr->magic = FIFOLOG_READER_MAGIC;
fr->magic = FIFOLOG_READER_MAGIC;
return (fr);
}
@ -144,7 +144,7 @@ fifolog_reader_seek(const struct fifolog_reader *fr, time_t t0)
e = fifolog_reader_findsync(fr->ff, &o);
if (e == 0)
return (0); /* empty fifolog */
assert(e == 1);
assert(e == 1);
assert(fr->ff->recbuf[4] & FIFOLOG_FLG_SYNC);
seq = be32dec(fr->ff->recbuf);
@ -297,7 +297,7 @@ fifolog_reader_process(struct fifolog_reader *fr, off_t from, fifolog_reader_ren
zs->avail_out, fr->olen);
exit (250);
#else
i = Z_OK;
#endif
}
@ -312,7 +312,7 @@ fifolog_reader_process(struct fifolog_reader *fr, off_t from, fifolog_reader_ren
if (zs->avail_out != fr->olen) {
q = fr->obuf + (fr->olen - zs->avail_out);
p = fifolog_reader_chop(fr, func, priv);
if (p < q)
if (p < q)
(void)memmove(fr->obuf, p, q - p);
zs->avail_out = fr->olen - (q - p);
zs->next_out = fr->obuf + (q - p);

View File

@ -52,12 +52,12 @@
const char *fifolog_write_statnames[] = {
[FIFOLOG_PT_BYTES_PRE] = "Bytes before compression",
[FIFOLOG_PT_BYTES_POST] = "Bytes after compression",
[FIFOLOG_PT_WRITES] = "Writes",
[FIFOLOG_PT_FLUSH] = "Flushes",
[FIFOLOG_PT_SYNC] = "Syncs",
[FIFOLOG_PT_RUNTIME] = "Runtime"
[FIFOLOG_PT_BYTES_PRE] = "Bytes before compression",
[FIFOLOG_PT_BYTES_POST] = "Bytes after compression",
[FIFOLOG_PT_WRITES] = "Writes",
[FIFOLOG_PT_FLUSH] = "Flushes",
[FIFOLOG_PT_SYNC] = "Syncs",
[FIFOLOG_PT_RUNTIME] = "Runtime"
};
/*
@ -182,7 +182,7 @@ fifolog_write_output(struct fifolog_writer *f, int fl, time_t now)
return (0);
if (h + l < (long)f->ff->recsize && fl == Z_NO_FLUSH)
if (h + l < (long)f->ff->recsize && fl == Z_NO_FLUSH)
return (0);
w = f->ff->recsize - l;
@ -258,7 +258,7 @@ fprintf(stderr, "Z len %3d fin %d now %ld fl %d ai %u ao %u\n",
#ifdef DBG
if (i || f->ff->zs->avail_in)
fprintf(stderr, "fl = %d, i = %d ai = %u ao = %u fx=%02x\n", fl, i,
fprintf(stderr, "fl = %d, i = %d ai = %u ao = %u fx=%02x\n", fl, i,
f->ff->zs->avail_in,
f->ff->zs->avail_out, f->flag);
#endif
@ -321,7 +321,7 @@ fifolog_write_bytes(struct fifolog_writer *f, uint32_t id, time_t now, const voi
if (now != f->last) {
id |= FIFOLOG_TIMESTAMP;
f->last = now;
}
}
/* Emit instance+flag */
be32enc(buf, id);

View File

@ -26,11 +26,11 @@
* $FreeBSD$
*/
#define ALLOC_OBJ(to, type_magic) \
#define ALLOC_OBJ(to, type_magic) \
do { \
(to) = calloc(sizeof *(to), 1); \
assert((to) != NULL); \
(to)->magic = (type_magic); \
if ((to) != NULL) \
(to)->magic = (type_magic); \
} while (0)
#define FREE_OBJ(to) \
@ -39,6 +39,9 @@
free(to); \
} while (0)
#define VALID_OBJ(ptr, type_magic) \
((ptr) != NULL && (ptr)->magic == (type_magic))
#define CHECK_OBJ(ptr, type_magic) \
do { \
assert((ptr)->magic == type_magic); \
@ -50,6 +53,12 @@
assert((ptr)->magic == type_magic); \
} while (0)
#define CHECK_OBJ_ORNULL(ptr, type_magic) \
do { \
if ((ptr) != NULL) \
assert((ptr)->magic == type_magic); \
} while (0)
#define CAST_OBJ(to, from, type_magic) \
do { \
(to) = (from); \
@ -57,10 +66,9 @@
CHECK_OBJ((to), (type_magic)); \
} while (0)
#define CAST_OBJ_NOTNULL(to, from, type_magic) \
#define CAST_OBJ_NOTNULL(to, from, type_magic) \
do { \
(to) = (from); \
assert((to) != NULL); \
CHECK_OBJ((to), (type_magic)); \
} while (0)