Commit: e77527a649c7140554647b915a4b645d33a4fc5b
Parent: 48557c84ca8cc255285c0cf4041342dbbc408054
Author: opask
Date: Fri, 31 Aug 2018 21:22:35 -0600
remove redundant error functions
Diffstat:
5 files changed, 3 insertions(+), 98 deletions(-)
diff --git a/error.c b/error.c
@@ -5,67 +5,6 @@
#include "links.h"
-volatile char dummy_val;
-volatile char * volatile dummy_ptr = &dummy_val;
-volatile char * volatile x_ptr;
-
-void *do_not_optimize_here(void *p)
-{
- /* break ANSI aliasing */
- x_ptr = p;
- *dummy_ptr = 0;
- return p;
-}
-
-static void er(char *m, va_list l)
-{
- vfprintf(stderr, cast_const_char m, l);
- fprintf(stderr, ANSI_BELL);
- fprintf(stderr, "\n");
- fflush(stderr);
- portable_sleep(1000);
-}
-
-void error(char *m, ...)
-{
- va_list l;
- va_start(l, m);
- er(m, l);
- va_end(l);
-}
-
-void fatal_exit(char *m, ...)
-{
- va_list l;
- fatal_tty_exit();
- va_start(l, m);
- er(m, l);
- va_end(l);
- fflush(stdout);
- fflush(stderr);
- exit(RET_FATAL);
-}
-
-int errline;
-unsigned char *errfile;
-
-static unsigned char errbuf[4096];
-
-void int_error(char *m, ...)
-{
-#ifdef NO_IE
- return;
-#else
- va_list l;
- fatal_tty_exit();
- va_start(l, m);
- sprintf((char *)errbuf, "\n"ANSI_SET_BOLD"INTERNAL ERROR"ANSI_CLEAR_BOLD" at %s:%d: %s", errfile, errline, m);
- er((char *)errbuf, l);
- va_end(l);
- exit(RET_INTERNAL);
-#endif
-}
-
void *mem_calloc(size_t size)
{
void *p;
diff --git a/html.c b/html.c
@@ -1361,9 +1361,6 @@ static void html_blockquote(unsigned char *a)
static void html_h(int h, unsigned char *a)
{
-#if defined(__GNUC__) && defined(__arm__)
- do_not_optimize_here(&h);
-#endif
#ifdef G
if (F) {
html_linebrk(a);
@@ -2553,12 +2550,6 @@ static void parse_frame_widths(unsigned char *a, int ww, int www, int **op, int
qq = q;
for (i = 0; i < ol; i++) {
q -= o[i] - o[i] * (d - qq) / (d ? d : 1);
-#ifdef __GNUC__
-#if __GNUC__ == 2
- do_not_optimize_here(&d);
-#endif
-#endif
- /* SIGH! gcc 2.7.2.* has an optimizer bug! */
o[i] = o[i] * (d - qq) / (d ? d : 1);
}
while (q) {
diff --git a/html_tbl.c b/html_tbl.c
@@ -1480,12 +1480,6 @@ void format_table(unsigned char *attr, unsigned char *html, unsigned char *eof,
}
if (!F && !border) cellsp = 0;
else if (!F && !cellsp) cellsp = 1;
- /* Sparc gcc-2.7.2.1 miscompiles this */
-#ifdef __GNUC__
-#if __GNUC__ == 2
- do_not_optimize_here(&cellsp);
-#endif
-#endif
if (!F && border > 2) border = 2;
if (!F && cellsp > 2) cellsp = 2;
#ifdef G
diff --git a/kbd.c b/kbd.c
@@ -393,11 +393,6 @@ static void free_trm(struct itrm *itrm)
if (itrm == ditrm) ditrm = NULL;
}
-void fatal_tty_exit(void)
-{
- if (ditrm) setcooked(ditrm->ctl_in);
-}
-
static void resize_terminal_x(unsigned char *text)
{
unsigned char *p;
diff --git a/links.h b/links.h
@@ -140,25 +140,12 @@ extern int F;
void die(const char *, ...);
void *xmalloc(size_t);
void *xrealloc(void *, size_t);
+#define internal die
+#define error die
+#define fatal_exit die
/* error.c */
-#define ANSI_BELL "\007"
-#define ANSI_SET_BOLD "\033[1m"
-#define ANSI_CLEAR_BOLD "\033[0m"
-
-void *do_not_optimize_here(void *p);
-void error(char *, ...);
-void fatal_exit(char *, ...);
-void int_error(char *, ...);
-extern int errline;
-extern unsigned char *errfile;
-
-#define internal_ errfile = cast_uchar __FILE__, errline = __LINE__, int_error
-#define internal internal_
-
-void fatal_tty_exit(void);
-
#define overalloc_at(f, l) \
do { \
fatal_exit("ERROR: attempting to allocate too large block at %s:%d", f, l);\
@@ -346,7 +333,6 @@ int c_open3(unsigned char *, int, int);
DIR *c_opendir(unsigned char *);
#ifdef OS_SETRAW
int setraw(int ctl, int save);
-void setcooked(int ctl);
#endif
int start_thread(void (*)(void *, int), void *, int, int);
unsigned char *get_clipboard_text(struct terminal *);