format **/*.c with clang-format-3.5
This has multiple effects: 1) The i3 codebase is now consistently formatted. clang-format uncovered plenty of places where inconsistent code made it into our code base. 2) When writing code, you don’t need to think or worry about our coding style. Write it in yours, then run clang-format-3.5 3) When submitting patches, we don’t need to argue about coding style. The basic idea is that we don’t want to care about _how_ we write the code, but _what_ it does :). The coding style that we use is defined in the .clang-format config file and is based on the google style, but adapted in such a way that the number of modifications to the i3 code base is minimal.
This commit is contained in:
@ -20,11 +20,11 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
ev_io *i3_connection;
|
||||
ev_io *i3_connection;
|
||||
|
||||
const char *sock_path;
|
||||
|
||||
typedef void(*handler_t)(char*);
|
||||
typedef void (*handler_t)(char *);
|
||||
|
||||
/*
|
||||
* Called, when we get a reply to a command from i3.
|
||||
@ -67,7 +67,7 @@ void got_output_reply(char *reply) {
|
||||
reconfig_windows(false);
|
||||
|
||||
i3_output *o_walk;
|
||||
SLIST_FOREACH(o_walk, outputs, slist) {
|
||||
SLIST_FOREACH (o_walk, outputs, slist) {
|
||||
kick_tray_clients(o_walk);
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ void got_bar_config_update(char *event) {
|
||||
char *found_id = strstr(event, expected_id);
|
||||
FREE(expected_id);
|
||||
if (found_id == NULL)
|
||||
return;
|
||||
return;
|
||||
|
||||
free_colors(&(config.colors));
|
||||
|
||||
@ -193,7 +193,7 @@ void got_data(struct ev_loop *loop, ev_io *watcher, int events) {
|
||||
int fd = watcher->fd;
|
||||
|
||||
/* First we only read the header, because we know its length */
|
||||
uint32_t header_len = strlen(I3_IPC_MAGIC) + sizeof(uint32_t)*2;
|
||||
uint32_t header_len = strlen(I3_IPC_MAGIC) + sizeof(uint32_t) * 2;
|
||||
char *header = smalloc(header_len);
|
||||
|
||||
/* We first parse the fixed-length IPC-header, to know, how much data
|
||||
@ -217,7 +217,7 @@ void got_data(struct ev_loop *loop, ev_io *watcher, int events) {
|
||||
|
||||
if (strncmp(header, I3_IPC_MAGIC, strlen(I3_IPC_MAGIC))) {
|
||||
ELOG("Wrong magic code: %.*s\n Expected: %s\n",
|
||||
(int) strlen(I3_IPC_MAGIC),
|
||||
(int)strlen(I3_IPC_MAGIC),
|
||||
header,
|
||||
I3_IPC_MAGIC);
|
||||
exit(EXIT_FAILURE);
|
||||
@ -225,10 +225,10 @@ void got_data(struct ev_loop *loop, ev_io *watcher, int events) {
|
||||
|
||||
char *walk = header + strlen(I3_IPC_MAGIC);
|
||||
uint32_t size;
|
||||
memcpy(&size, (uint32_t*)walk, sizeof(uint32_t));
|
||||
memcpy(&size, (uint32_t *)walk, sizeof(uint32_t));
|
||||
walk += sizeof(uint32_t);
|
||||
uint32_t type;
|
||||
memcpy(&type, (uint32_t*)walk, sizeof(uint32_t));
|
||||
memcpy(&type, (uint32_t *)walk, sizeof(uint32_t));
|
||||
|
||||
/* Now that we know, what to expect, we can start read()ing the rest
|
||||
* of the message */
|
||||
@ -274,7 +274,7 @@ int i3_send_msg(uint32_t type, const char *payload) {
|
||||
}
|
||||
|
||||
/* We are a wellbehaved client and send a proper header first */
|
||||
uint32_t to_write = strlen (I3_IPC_MAGIC) + sizeof(uint32_t)*2 + len;
|
||||
uint32_t to_write = strlen(I3_IPC_MAGIC) + sizeof(uint32_t) * 2 + len;
|
||||
/* TODO: I'm not entirely sure if this buffer really has to contain more
|
||||
* than the pure header (why not just write() the payload from *payload?),
|
||||
* but we leave it for now */
|
||||
|
Reference in New Issue
Block a user