sanity.{cpp,h}: remove, entirely unused

insane in the brain
This commit is contained in:
Aaron Gyes 2021-12-09 00:41:47 -08:00
parent 815502fa9e
commit b3a4b23d9b
5 changed files with 0 additions and 54 deletions

View file

@ -26,7 +26,6 @@
#include "parse_util.h"
#include "proc.h"
#include "reader.h"
#include "sanity.h"
#include "signal.h"
#include "wutil.h" // IWYU pragma: keep

View file

@ -50,7 +50,6 @@
#include "parser.h"
#include "proc.h"
#include "reader.h"
#include "sanity.h"
#include "signal.h"
#include "wcstringutil.h"
#include "wutil.h" // IWYU pragma: keep

View file

@ -71,7 +71,6 @@
#include "parser.h"
#include "proc.h"
#include "reader.h"
#include "sanity.h"
#include "screen.h"
#include "signal.h"
#include "termsize.h"

View file

@ -1,36 +0,0 @@
// Functions for performing sanity checks on the program state.
#include "config.h" // IWYU pragma: keep
#include "sanity.h"
#include <unistd.h>
#include "common.h"
#include "fallback.h" // IWYU pragma: keep
#include "flog.h"
#include "global_safety.h"
#include "history.h"
#include "kill.h"
#include "proc.h"
#include "reader.h"
/// Status from earlier sanity checks.
static relaxed_atomic_bool_t insane{false};
void sanity_lose() {
FLOG(error, _(L"Errors detected, shutting down. Break on sanity_lose() to debug."));
insane = true;
}
void validate_pointer(const void *ptr, const wchar_t *err, int null_ok) {
// Test if the pointer data crosses a segment boundary.
if ((0x00000003L & reinterpret_cast<intptr_t>(ptr)) != 0) {
FLOGF(error, _(L"The pointer '%ls' is invalid"), err);
sanity_lose();
}
if ((!null_ok) && (ptr == nullptr)) {
FLOGF(error, _(L"The pointer '%ls' is null"), err);
sanity_lose();
}
}

View file

@ -1,15 +0,0 @@
// Prototypes for functions for performing sanity checks on the program state.
#ifndef FISH_SANITY_H
#define FISH_SANITY_H
/// Call this function to tell the program it is not in a sane state.
void sanity_lose();
/// Try and determine if ptr is a valid pointer. If not, loose sanity.
///
/// \param ptr The pointer to validate
/// \param err A description of what the pointer refers to, for use in error messages
/// \param null_ok Whether the pointer is allowed to point to 0
void validate_pointer(const void *ptr, const wchar_t *err, int null_ok);
#endif