obmc-console: Add clang-format configuration
And apply the formatting.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I75251051affa5129c8698185baf8d151302b19d6
diff --git a/ringbuffer.c b/ringbuffer.c
index 14cb63d..996dc49 100644
--- a/ringbuffer.c
+++ b/ringbuffer.c
@@ -29,18 +29,18 @@
}
struct ringbuffer {
- uint8_t *buf;
- size_t size;
- size_t tail;
- struct ringbuffer_consumer **consumers;
- int n_consumers;
+ uint8_t *buf;
+ size_t size;
+ size_t tail;
+ struct ringbuffer_consumer **consumers;
+ int n_consumers;
};
struct ringbuffer_consumer {
- struct ringbuffer *rb;
- ringbuffer_poll_fn_t poll_fn;
- void *poll_data;
- size_t pos;
+ struct ringbuffer *rb;
+ ringbuffer_poll_fn_t poll_fn;
+ void *poll_data;
+ size_t pos;
};
struct ringbuffer *ringbuffer_init(size_t size)
@@ -65,8 +65,9 @@
free(rb);
}
-struct ringbuffer_consumer *ringbuffer_consumer_register(struct ringbuffer *rb,
- ringbuffer_poll_fn_t fn, void *data)
+struct ringbuffer_consumer *
+ringbuffer_consumer_register(struct ringbuffer *rb, ringbuffer_poll_fn_t fn,
+ void *data)
{
struct ringbuffer_consumer *rbc;
int n;
@@ -79,7 +80,7 @@
n = rb->n_consumers++;
rb->consumers = realloc(rb->consumers,
- sizeof(*rb->consumers) * rb->n_consumers);
+ sizeof(*rb->consumers) * rb->n_consumers);
rb->consumers[n] = rbc;
return rbc;
@@ -98,11 +99,11 @@
rb->n_consumers--;
- memmove(&rb->consumers[i], &rb->consumers[i+1],
- sizeof(*rb->consumers) * (rb->n_consumers - i));
+ memmove(&rb->consumers[i], &rb->consumers[i + 1],
+ sizeof(*rb->consumers) * (rb->n_consumers - i));
rb->consumers = realloc(rb->consumers,
- sizeof(*rb->consumers) * rb->n_consumers);
+ sizeof(*rb->consumers) * rb->n_consumers);
free(rbc);
}
@@ -120,8 +121,8 @@
return rbc->rb->size - ringbuffer_len(rbc) - 1;
}
-static int ringbuffer_consumer_ensure_space(
- struct ringbuffer_consumer *rbc, size_t len)
+static int ringbuffer_consumer_ensure_space(struct ringbuffer_consumer *rbc,
+ size_t len)
{
enum ringbuffer_poll_ret prc;
int force_len;
@@ -178,7 +179,6 @@
memcpy(rb->buf, data, len);
rb->tail += len;
-
/* Inform consumers of new data in non-blocking mode, by calling
* ->poll_fn with 0 force_len */
for (i = 0; i < rb->n_consumers; i++) {
@@ -196,7 +196,7 @@
}
size_t ringbuffer_dequeue_peek(struct ringbuffer_consumer *rbc, size_t offset,
- uint8_t **data)
+ uint8_t **data)
{
struct ringbuffer *rb = rbc->rb;
size_t pos;