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:
@ -29,7 +29,7 @@ static int version_string(void *ctx, const unsigned char *val, size_t len) {
|
||||
|
||||
static int version_map_key(void *ctx, const unsigned char *stringval, size_t stringlen) {
|
||||
human_readable_key = (stringlen == strlen("human_readable") &&
|
||||
strncmp((const char*)stringval, "human_readable", strlen("human_readable")) == 0);
|
||||
strncmp((const char *)stringval, "human_readable", strlen("human_readable")) == 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -76,11 +76,11 @@ void display_running_version(void) {
|
||||
memset(&addr, 0, sizeof(struct sockaddr_un));
|
||||
addr.sun_family = AF_LOCAL;
|
||||
strncpy(addr.sun_path, socket_path, sizeof(addr.sun_path) - 1);
|
||||
if (connect(sockfd, (const struct sockaddr*)&addr, sizeof(struct sockaddr_un)) < 0)
|
||||
if (connect(sockfd, (const struct sockaddr *)&addr, sizeof(struct sockaddr_un)) < 0)
|
||||
err(EXIT_FAILURE, "Could not connect to i3");
|
||||
|
||||
if (ipc_send_message(sockfd, 0, I3_IPC_MESSAGE_TYPE_GET_VERSION,
|
||||
(uint8_t*)"") == -1)
|
||||
(uint8_t *)"") == -1)
|
||||
err(EXIT_FAILURE, "IPC: write()");
|
||||
|
||||
uint32_t reply_length;
|
||||
@ -98,7 +98,7 @@ void display_running_version(void) {
|
||||
|
||||
yajl_handle handle = yajl_alloc(&version_callbacks, NULL, NULL);
|
||||
|
||||
yajl_status state = yajl_parse(handle, (const unsigned char*)reply, (int)reply_length);
|
||||
yajl_status state = yajl_parse(handle, (const unsigned char *)reply, (int)reply_length);
|
||||
if (state != yajl_status_ok)
|
||||
errx(EXIT_FAILURE, "Could not parse my own reply. That's weird. reply is %.*s", (int)reply_length, reply);
|
||||
|
||||
@ -113,8 +113,8 @@ void display_running_version(void) {
|
||||
sasprintf(&exepath, "/proc/%d/exe", getpid());
|
||||
|
||||
while ((linksize = readlink(exepath, destpath, destpath_size)) == (ssize_t)destpath_size) {
|
||||
destpath_size = destpath_size * 2;
|
||||
destpath = srealloc(destpath, destpath_size);
|
||||
destpath_size = destpath_size * 2;
|
||||
destpath = srealloc(destpath, destpath_size);
|
||||
}
|
||||
if (linksize == -1)
|
||||
err(EXIT_FAILURE, "readlink(%s)", exepath);
|
||||
|
Reference in New Issue
Block a user