aboutsummaryrefslogtreecommitdiff
path: root/i3-dump-log
diff options
context:
space:
mode:
authorOrestis Floros <orestisflo@gmail.com>2024-01-27 11:37:05 +0100
committerGitHub <noreply@github.com>2024-01-27 11:37:05 +0100
commitf1696245608945eadc25105cf3fe41717551d968 (patch)
treeeb60e46a32c72d2aad1891e74424ac27376bdc58 /i3-dump-log
parent5fdfb145306a84ffb3dd6c89869c58826b5e3401 (diff)
downloadi3-f1696245608945eadc25105cf3fe41717551d968.tar.gz
i3-f1696245608945eadc25105cf3fe41717551d968.zip
clang-format: enable InsertBraces (#5882)
Enforces a rule that we have followed for years now. Yes, the diff is quite big but we get it over with once and we prevent having to nit-pick future PRs.
Diffstat (limited to 'i3-dump-log')
-rw-r--r--i3-dump-log/main.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/i3-dump-log/main.c b/i3-dump-log/main.c
index 0ce22264..9b40a630 100644
--- a/i3-dump-log/main.c
+++ b/i3-dump-log/main.c
@@ -39,8 +39,9 @@ static int ipcfd = -1;
static void disable_shmlog(void) {
const char *disablecmd = "debuglog off; shmlog off";
if (ipc_send_message(ipcfd, strlen(disablecmd),
- I3_IPC_MESSAGE_TYPE_COMMAND, (uint8_t *)disablecmd) != 0)
+ I3_IPC_MESSAGE_TYPE_COMMAND, (uint8_t *)disablecmd) != 0) {
err(EXIT_FAILURE, "IPC send");
+ }
/* Ensure the command was sent by waiting for the reply: */
uint32_t reply_length = 0;
@@ -53,8 +54,9 @@ static void disable_shmlog(void) {
}
static int check_for_wrap(void) {
- if (wrap_count == header->wrap_count)
+ if (wrap_count == header->wrap_count) {
return 0;
+ }
/* The log wrapped. Print the remaining content and reset walk to the top
* of the log. */
@@ -148,8 +150,9 @@ int main(int argc, char *argv[]) {
ipcfd = ipc_connect(NULL);
const char *enablecmd = "debuglog on; shmlog 5242880";
if (ipc_send_message(ipcfd, strlen(enablecmd),
- I3_IPC_MESSAGE_TYPE_COMMAND, (uint8_t *)enablecmd) != 0)
+ I3_IPC_MESSAGE_TYPE_COMMAND, (uint8_t *)enablecmd) != 0) {
err(EXIT_FAILURE, "IPC send");
+ }
/* By the time we receive a reply, I3_SHMLOG_PATH is set: */
uint32_t reply_length = 0;
uint8_t *reply = NULL;
@@ -175,8 +178,9 @@ int main(int argc, char *argv[]) {
}
}
- if (*shmname == '\0')
+ if (*shmname == '\0') {
errx(EXIT_FAILURE, "Cannot dump log: SHM logging is disabled in i3.");
+ }
struct stat statbuf;
@@ -211,8 +215,9 @@ int main(int argc, char *argv[]) {
/* In case there was a write to the buffer already, skip the first
* old line, it very likely is mangled. Not a problem, though, the log
* is chatty enough to have plenty lines left. */
- while (*walk != '\n')
+ while (*walk != '\n') {
walk++;
+ }
walk++;
}