aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sanity.cpp
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2016-05-03 12:31:07 -0700
committerGravatar Kurtis Rader <krader@skepticism.us>2016-05-03 12:53:54 -0700
commitfa5356373377a5792e260468b04c8344f0e3448e (patch)
tree40a4edc1f989b23fb6338bd5cdfdbdfbbbc715da /src/sanity.cpp
parent835176ef324b049d5195a0276b8d7eb1b3b85c47 (diff)
restyle sanity & screen module to match project style
Reduces lint errors from 163 to 112 (-31%). Line count from 1866 to 1493 (-20%). Another step in resolving issue #2902.
Diffstat (limited to 'src/sanity.cpp')
-rw-r--r--src/sanity.cpp51
1 files changed, 16 insertions, 35 deletions
diff --git a/src/sanity.cpp b/src/sanity.cpp
index 43480126..d6da40f4 100644
--- a/src/sanity.cpp
+++ b/src/sanity.cpp
@@ -1,60 +1,41 @@
-/** \file sanity.c
- Functions for performing sanity checks on the program state
-*/
+// Functions for performing sanity checks on the program state.
#include <unistd.h>
-#include "fallback.h" // IWYU pragma: keep
#include "common.h"
-#include "sanity.h"
-#include "proc.h"
+#include "fallback.h" // IWYU pragma: keep
#include "history.h"
-#include "reader.h"
#include "kill.h"
+#include "proc.h"
+#include "reader.h"
+#include "sanity.h"
-/**
- Status from earlier sanity checks
-*/
+/// Status from earlier sanity checks.
static int insane;
-void sanity_lose()
-{
+void sanity_lose() {
debug(0, _(L"Errors detected, shutting down. Break on sanity_lose() to debug."));
insane = 1;
}
-int sanity_check()
-{
- if (!insane)
- if (get_is_interactive())
- history_sanity_check();
+int sanity_check() {
if (!insane)
- reader_sanity_check();
- if (!insane)
- kill_sanity_check();
- if (!insane)
- proc_sanity_check();
+ if (get_is_interactive()) history_sanity_check();
+ if (!insane) reader_sanity_check();
+ if (!insane) kill_sanity_check();
+ if (!insane) proc_sanity_check();
return insane;
}
-void validate_pointer(const void *ptr, const wchar_t *err, int null_ok)
-{
-
- /*
- Test if the pointer data crosses a segment boundary.
- */
-
- if ((0x00000003l & (intptr_t)ptr) != 0)
- {
+void validate_pointer(const void *ptr, const wchar_t *err, int null_ok) {
+ // Test if the pointer data crosses a segment boundary.
+ if ((0x00000003l & (intptr_t)ptr) != 0) {
debug(0, _(L"The pointer '%ls' is invalid"), err);
sanity_lose();
}
- if ((!null_ok) && (ptr==0))
- {
+ if ((!null_ok) && (ptr == 0)) {
debug(0, _(L"The pointer '%ls' is null"), err);
sanity_lose();
}
}
-
-