links

lynx-like text mode web browser
git clone anongit@rnpnr.xyz:links.git
Log | Files | Refs | Feed | README | LICENSE

Commit: f991d0f168c741315a8c980cf289f0cda4a6ac48
Parent: 39b6a5bb0ba8823c2fcc8530e9ebee9ad14b385b
Author: opask
Date:   Fri,  7 Dec 2018 17:51:12 -0700

delete dead code, unused constants, and uneeded includes

Diffstat:
Mdip.c | 3---
Mgif.c | 3---
Mhtml.c | 18------------------
Mhtml_r.c | 9---------
Mhtml_tbl.c | 15---------------
Mimg.c | 140+------------------------------------------------------------------------------
Mjpeg.c | 3---
Mlinks.h | 23++---------------------
Mos_dep.c | 2--
Mpng.c | 5-----
Mselect.c | 67+++----------------------------------------------------------------
Msession.c | 4----
Msetup.h | 17-----------------
13 files changed, 6 insertions(+), 303 deletions(-)

diff --git a/dip.c b/dip.c @@ -1634,9 +1634,6 @@ static inline int print_letter(struct graphics_device *device, int x, int y, str /* Find a suitable letter */ letter = find_stored_letter(style->table, char_number); -#ifdef DEBUG - if (!letter) internal("print_letter could not find a letter - even not the blotch!"); -#endif /* #ifdef DEBUG */ templat.r0 = style->r0; templat.r1 = style->r1; templat.g0 = style->g0; diff --git a/gif.c b/gif.c @@ -563,9 +563,6 @@ static void gif_restart_internal(unsigned char *data, int length) void gif_restart(unsigned char *data, int length) { -#ifdef DEBUG - if (!global_cimg->decoder) internal("NULL decoder in gif_restart"); -#endif /* #ifdef DEBUG */ end_callback_hit=0; gif_restart_internal(data, length); if (end_callback_hit) img_end(global_cimg); diff --git a/html.c b/html.c @@ -537,24 +537,6 @@ void kill_html_stack_item(struct html_element *e) free(e); } -#if defined(DEBUG) && 0 -void debug_stack(void) -{ - struct html_element *e; - struct list_head *le; - printf("HTML stack debug: \n"); - foreachback(struct html_element, e, le, html_stack) { - int i; - printf("\""); - for (i = 0; i < e->namelen; i++) printf("%c", e->name[i]); - printf("\"\n"); - } - printf("%c", 7); - fflush(stdout); - portable_sleep(1000); -} -#endif - void html_stack_dup(void) { struct html_element *e; diff --git a/html_r.c b/html_r.c @@ -268,12 +268,6 @@ static void xpand_line(struct part *p, int y, int x) if (!p->data) return; x = safe_add(x, p->xp); y = safe_add(y, p->yp); -#ifdef DEBUG - if (y >= p->data->y) { - internal("line does not exist"); - return; - } -#endif ln = &p->data->data[y]; if (x >= ln->l) { int i; @@ -507,9 +501,6 @@ static int split_line(struct part *p) split: if (safe_add(i, par_format.rightmargin) > p->x) p->x = i + par_format.rightmargin; if (p->data) { -#ifdef DEBUG - if (POS(i, p->cy).ch != ' ') internal("bad split: %c", (unsigned char)POS(i, p->cy).ch); -#endif move_chars(p, safe_add(i,1), p->cy, par_format.leftmargin, safe_add(p->cy,1)); del_chars(p, i, p->cy); } diff --git a/html_tbl.c b/html_tbl.c @@ -6,14 +6,8 @@ #include "links.h" -#ifdef DEBUG -#undef DEBUG -#endif - static void free_table_cache(void); -/*#define DEBUG*/ - #define RECT_BOUND_BITS 10 /* --- bound at 1024 pixels */ #define AL_TR -1 @@ -163,11 +157,7 @@ struct table { }; -#ifdef DEBUG -#define CELL(t, x, y) (((x) < 0 || (x) >= (t)->rx || (y) < 0 || (y) >= (t)->ry) ? (internal("accessing cell out of table (%d,%d) - limit (%d,%d)", (x), (y), (t)->rx, (t)->ry), (t)->cells) : &(t)->cells[(y) * (t)->rx + (x)]) -#else #define CELL(t, x, y) (&(t)->cells[(y) * (t)->rx + (x)]) -#endif static unsigned char frame_table[81] = { 0x00, 0xb3, 0xba, 0xc4, 0xc0, 0xd3, 0xcd, 0xd4, 0xc8, @@ -1327,13 +1317,8 @@ if (H_LINE_X((ii), (jj)) >= 0) xset_hchars(t->p, (xx), (yy), (ll), hline_table[H int qq; \ if (V_LINE_X((ii), (jj)) >= 0) for (qq = 0; qq < (ll); qq++) xset_hchar(t->p, (xx), safe_add((yy), qq), vline_table[V_LINE((ii), (jj))], AF); } -#ifndef DEBUG #define H_LINE_X(xx, yy) fh[(xx) + 1 + (t->x + 2) * (yy)] #define V_LINE_X(xx, yy) fv[(yy) + 1 + (t->y + 2) * (xx)] -#else -#define H_LINE_X(xx, yy) (*((xx) < -1 || (xx) > t->x + 1 || (yy) < 0 || (yy) > t->y ? (short *)NULL : &fh[(xx) + 1 + (t->x + 2) * (yy)])) -#define V_LINE_X(xx, yy) (*((xx) < 0 || (xx) > t->x || (yy) < -1 || (yy) > t->y + 1 ? (short *)NULL : &fv[(yy) + 1 + (t->y + 2) * (xx)])) -#endif #define H_LINE(xx, yy) (H_LINE_X((xx), (yy)) < 0 ? 0 : H_LINE_X((xx), (yy))) #define V_LINE(xx, yy) (V_LINE_X((xx), (yy)) < 0 ? 0 : V_LINE_X((xx), (yy))) diff --git a/img.c b/img.c @@ -99,12 +99,6 @@ void img_destruct_cached_image(struct cached_image *cimg) case 15: drv->unregister_bitmap(&(cimg->bmp)); break; - -#ifdef DEBUG - default: - fprintf(stderr,"img_destruct_cached_image: state=%d\n",cimg->state); - internal("Invalid state in struct cached_image"); -#endif /* #ifdef DEBUG */ } free(cimg->url); free(cimg); @@ -206,12 +200,6 @@ int header_dimensions_known(struct cached_image *cimg) { unsigned short red, green, blue; -#ifdef DEBUG - if ((cimg->state^8)&13){ - fprintf(stderr,"cimg->state=%d\n",cimg->state); - internal("Invalid state in header_dimensions_known"); - } -#endif /* #ifdef DEBUG */ if (cimg->width<1||cimg->height<1){ /*fprintf(stderr,"width=%d height=%d\n",cimg->width, cimg->height);*/ return 1; @@ -284,13 +272,6 @@ int header_dimensions_known(struct cached_image *cimg) round_color_sRGB_to_48(&red, &green, &blue , cimg->background_color); mix_one_color_48(buf_16,cimg->width, red, green, blue); -#ifdef DEBUG - if (cimg->height<=0){ - fprintf(stderr,"cimg->height=%d\n",cimg->height); - internal("Invalid cimg->height in strip_optimized section of\ - header_dimensions_known"); - } -#endif /* #ifdef DEBUG */ /* The skip is uninitialized here and is read by dither_start * but is not used in any malicious way so it doesn't matter */ @@ -372,12 +353,6 @@ static unsigned short *buffer_to_16(unsigned short *tmp, struct cached_image *ci { unsigned short red, green, blue; -#ifdef DEBUG - if (cimg->state != 12 && cimg->state != 14) { - fprintf(stderr, "cimg->state=%d\n", cimg->state); - internal("invalid state in buffer_to_16"); - } -#endif /* #ifdef DEBUG */ switch (cimg->buffer_bytes_per_pixel) { case 3: if (cimg->gamma_table) @@ -437,12 +412,6 @@ static unsigned short *buffer_to_16(unsigned short *tmp, struct cached_image *ci (float)(user_gamma / cimg->blue_gamma), red, green, blue); break; - -#ifdef DEBUG - default: - internal("buffer_to_16: unknown mem organization"); -#endif /* #ifdef DEBUG */ - } return tmp; } @@ -471,22 +440,6 @@ void buffer_to_bitmap_incremental(struct cached_image *cimg struct bitmap tmpbmp; int add1=0, add2; -#ifdef DEBUG - if (cimg->state!=12&&cimg->state!=14){ - fprintf(stderr,"cimg->state=%d\n",cimg->state); - internal("Invalid state in buffer_to_bitmap_incremental\n"); - } - if (height<1){ - fprintf(stderr,"height=%d\n",height); - internal("Invalid height in buffer_to_bitmap_incremental\n"); - } - if (cimg->width<1||cimg->height<1){ - fprintf(stderr,"cimg->width=%d, cimg->height=%d\n",cimg->width, - cimg->height); - internal("Invalid cimg->width x cimg->height in\ -buffer_to_bitmap_incremental"); - } -#endif /* #ifdef DEBUG */ if ((unsigned)cimg->width > INT_MAX / max_height / 3 / sizeof(*tmp)) overalloc(); tmp = xmalloc(cimg->width*(height<max_height?height:max_height)*3*sizeof(*tmp)); /* Prepare a fake bitmap for dithering */ @@ -542,21 +495,6 @@ static void buffer_to_bitmap(struct cached_image *cimg) int ix, iy, ox, oy, gonna_be_smart; int *dregs; -#ifdef DEBUG - if(cimg->state!=12&&cimg->state!=14){ - fprintf(stderr,"cimg->state=%d\n",cimg->state); - internal("buffer_to_bitmap called in invalid state"); - } - if (cimg->strip_optimized) internal("strip_optimized in buffer_to_bitmap"); - if (cimg->width<1||cimg->height<1){ - fprintf(stderr,"cimg->width=%d, cimg->height=%d\n",cimg->width, - cimg->height); - internal("Invalid cimg->width x cimg->height in\ -buffer_to_bitmap"); - } -#endif /* #ifdef DEBUG */ - - if (!cimg->rows_added) return; /* Here of course width and height must be already filled */ @@ -578,11 +516,6 @@ buffer_to_bitmap"); } /* Scale the image to said size */ -#ifdef DEBUG - if (ox<=0||oy<=0){ - internal("ox or oy <=0 before resampling image"); - } -#endif /* #ifdef DEBUG */ if (tmp && (ix!=ox || iy!=oy)) { /* We must really scale */ tmp1=tmp; @@ -659,11 +592,6 @@ void img_end(struct cached_image *cimg) case 13: case 15: break; -#ifdef DEBUG - default: - fprintf(stderr,"state=%d\n",cimg->state); - internal("Invalid state encountered in end"); -#endif /* #ifdef DEBUG */ } cimg->state|=1; } @@ -713,12 +641,6 @@ static void r3l0ad(struct cached_image *cimg, struct g_object_image *goi) drv->unregister_bitmap(&cimg->bmp); } break; - -#ifdef DEBUG - default: - fprintf(stderr,"cimg->state=%d\n",cimg->state); - internal("Invalid state in r3l0ad()"); -#endif /* #ifdef DEBUG */ } cimg->state&=2; } @@ -734,12 +656,6 @@ static inline int dtest(unsigned char *templat, unsigned char *test) /* This may be called only in state 0 or 2 */ static void type(struct cached_image *cimg, unsigned char *content_type, unsigned char *data /* at least 4 bytes */) { -#ifdef DEBUG - if (cimg->state!=0&&cimg->state!=2){ - fprintf(stderr,"cimg->state=%d\n",cimg->state); - internal("Invalid state encountered in type()"); - } -#endif /* #ifdef DEBUG */ #ifdef HAVE_JPEG if (data[0] == 0xff && data[1] == 0xd8) goto have_jpeg; @@ -795,13 +711,6 @@ static int img_process_download(struct g_object_image *goi, struct f_data_c *fda struct cached_image *cimg = goi->cimg; int chopped=0; -#ifdef DEBUG - if (!goi->af) internal("NULL goi->af in process_download\n"); - if (cimg->state>=16){ /* Negative don't occur because it's unsigned char */ - fprintf(stderr,"cimg->state=%d\n",cimg->state); - internal("Invalid cimg->state in img_process_download\n"); - } -#endif /* #ifdef DEBUG */ if (!goi->af->rq) return 0; if (get_file(goi->af->rq, &data, &dataend)) goto end; if (dataend - data < 4) goto end; @@ -853,12 +762,6 @@ static int img_process_download(struct g_object_image *goi, struct f_data_c *fda case IM_GIF: gif_restart(data,length); break; -#ifdef DEBUG - default: - fprintf(stderr,"cimg->image_type=%d\n",cimg->state); - internal("Invalid image_type encountered when processing data in\ -img_process_download.\n"); -#endif /* #ifdef DEBUG */ } cimg->last_length+=length; } @@ -906,9 +809,6 @@ int get_foreground(int rgb) static void draw_frame_mark(struct graphics_device *dev, int x, int y, int xw, int yw, long bg, long fg, int broken) { -#ifdef DEBUG - if (xw<1||yw<1) internal("zero dimension in draw_frame_mark"); -#endif /* #ifdef DEBUG */ if (broken == 1){ /* Draw between ( 0 and 1/4 ) and ( 3/4 and 1 ) of each * side (0-1) @@ -977,22 +877,10 @@ static void draw_picture(struct f_data_c *fdatac, struct g_object_image *goi, struct cached_image *cimg=goi->cimg; struct rect saved; -#ifdef DEBUG - if (goi->cimg->state<12||goi->cimg->state>=16){ - fprintf(stderr,"cimg->state=%d\n",cimg->state); - internal("Invalid cimg->state in draw_picture"); - } -#endif /* #ifdef DEBUG */ if (!(cimg->state&1)){ if (!cimg->bmp_used) buffer_to_bitmap(cimg); } -#ifdef DEBUG - else if (!cimg->bmp_used){ - fprintf(stderr,"cimg->state=%d\n",cimg->state); - internal("Nonexistent bitmap in said cimg->state in draw_picture"); - } -#endif /* #ifdef DEBUG */ restrict_clip_area(dev, &saved, x, y, x+goi->goti.go.xw, y+goi->goti.go.yw); drv->draw_bitmap(dev, &cimg->bmp,x,y); drv->fill_area(dev, x + cimg->bmp.x, y, x + goi->goti.go.xw, y + cimg->bmp.y, bg); @@ -1005,12 +893,6 @@ static void draw_picture(struct f_data_c *fdatac, struct g_object_image *goi, */ static void update_bitmap(struct cached_image *cimg) { -#ifdef DEBUG - if (cimg->state<12||cimg->state>=16){ - fprintf(stderr,"cimg->state=%d\n",cimg->state); - internal("Invalid state in update_bitmap"); - } -#endif /* #ifdef DEBUG */ if (!(cimg->state&1)&& !cimg->strip_optimized &&cimg->rows_added) buffer_to_bitmap(cimg); @@ -1054,27 +936,12 @@ static void img_draw_image(struct f_data_c *fdatac, struct g_object *goi_, int x if (!cimg || cimg->state<12){ draw_frame_mark(fdatac->ses->term->dev,x,y,goi->goti.go.xw, goi->goti.go.yw,color_bg,color_fg,!cimg || cimg->state&1); - }else -#ifdef DEBUG - if (cimg->state<16){ -#else - { -#endif /* #ifdef DEBUG */ + } else { update_bitmap(cimg); draw_picture(fdatac,goi,x,y,color_bg); } -#ifdef DEBUG - else{ - fprintf(stderr,"cimg->state=%d\n",cimg->state); - internal("Invalid state in img_draw_image"); - } -#endif /* #ifdef DEBUG */ ret: set_clip_area(fdatac->ses->term->dev, &r); -#ifdef LINKS_TESTMODE_IMAGE_AUTO_EXIT - if (cimg->state & 1) - terminate_loop = 1; -#endif } /* Prior to calling this function you have to fill out @@ -1096,11 +963,6 @@ static void find_or_make_cached_image(struct g_object_image *image, unsigned cha cimg = xmalloc(sizeof(*cimg)); cimg->refcount = 1; cimg->background_color = image->background; -#ifdef DEBUG - if (!url) - internal ("NULL url as argument of\ -find_or_make_cached_image"); -#endif /* #ifdef DEBUG */ cimg->scale = scale; cimg->aspect = aspect; cimg->url = stracpy(url); diff --git a/jpeg.c b/jpeg.c @@ -183,9 +183,6 @@ void jpeg_restart(struct cached_image *cimg, unsigned char *data, int length) struct jpg_decoder *deco; deco=(struct jpg_decoder *)(cimg->decoder); -#ifdef DEBUG - if (!deco) internal("NULL decoder in jpeg_restart"); -#endif /* #ifdef DEBUG */ global_cinfo=((struct jpg_decoder *)(cimg->decoder))->cinfo; global_jerr=((struct jpg_decoder *)(cimg->decoder))->jerr; /* These global variables are here so that we don't have to pass lots diff --git a/links.h b/links.h @@ -8,11 +8,11 @@ #include <dirent.h> #include <errno.h> +#include <event.h> #include <fcntl.h> #include <grp.h> -#include <inttypes.h> -#include <limits.h> #include <netdb.h> +#include <poll.h> #include <pwd.h> #include <search.h> #include <signal.h> @@ -21,34 +21,20 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <strings.h> -#include <sys/file.h> -#include <sys/resource.h> -#include <sys/select.h> #include <sys/socket.h> #include <sys/stat.h> -#include <sys/time.h> -#include <sys/types.h> #include <sys/utsname.h> #include <sys/wait.h> #include <termios.h> -#include <time.h> #include <unistd.h> -#include <utime.h> #include "os_dep.h" #include "setup.h" #include <arpa/inet.h> -#include <netinet/in.h> -#include <netinet/in_systm.h> -#include <netinet/ip.h> #include <openssl/ssl.h> -#include <openssl/rand.h> -#include <openssl/x509v3.h> #include <openssl/err.h> -#include <openssl/crypto.h> #if defined(G) #if defined(HAVE_PNG_H) @@ -62,11 +48,6 @@ #endif /* _SETJMP_H */ #endif /* #if defined(G) */ -#define USE_POLL -#include <poll.h> - -#include <event.h> -#define USE_LIBEVENT #define longlong long long #define ulonglong unsigned long long diff --git a/os_dep.c b/os_dep.c @@ -281,10 +281,8 @@ void close_fork_tty(void) struct k_conn *k = NULL; struct list_head *lk; int rs; -#ifndef NO_SIGNAL_HANDLERS EINTRLOOP(rs, close(signal_pipe[0])); EINTRLOOP(rs, close(signal_pipe[1])); -#endif if (terminal_pipe[1] != -1) EINTRLOOP(rs, close(terminal_pipe[1])); foreach(struct terminal, t, lt, terminals) { if (t->fdin > 0) diff --git a/png.c b/png.c @@ -161,11 +161,6 @@ void png_restart(struct cached_image *cimg, unsigned char *data, int length) png_infop info_ptr; volatile int h; -#ifdef DEBUG - if (!cimg->decoder) - internal("decoder NULL in png_restart\n"); - -#endif /* #ifdef DEBUG */ h = close_stderr(); png_ptr=((struct png_decoder *)(cimg->decoder))->png_ptr; info_ptr=((struct png_decoder *)(cimg->decoder))->info_ptr; diff --git a/select.c b/select.c @@ -6,11 +6,6 @@ #include "links.h" -/* -#define DEBUG_CALLS -*/ - -#ifdef USE_LIBEVENT #if defined(evtimer_set) && !defined(timeout_set) #define timeout_set evtimer_set #endif @@ -20,16 +15,13 @@ #if defined(evtimer_del) && !defined(timeout_del) #define timeout_del evtimer_del #endif -#endif struct thread { void (*read_func)(void *); void (*write_func)(void *); void *data; -#ifdef USE_LIBEVENT struct event *read_event; struct event *write_event; -#endif }; static struct thread *threads = NULL; @@ -74,7 +66,6 @@ static int can_do_io(int fd, int wr, int sec) if (fd < 0) die("can_do_io: handle %d", fd); -#if defined(USE_POLL) struct pollfd p; p.fd = fd; p.events = !wr ? POLLIN : POLLOUT; @@ -87,7 +78,6 @@ static int can_do_io(int fd, int wr, int sec) goto fallback; return 1; fallback: -#endif if (sec >= 0) { tv.tv_sec = sec; tv.tv_usec = 0; @@ -252,8 +242,6 @@ skip_limit:; unsigned char *sh_file; int sh_line; -#ifdef USE_LIBEVENT - static int event_enabled = 0; #ifndef HAVE_EVENT_GET_STRUCT_EVENT_SIZE @@ -398,15 +386,10 @@ static void do_event_loop(int flags) die("event_base_loop: %s\n", strerror(errno)); } -#endif - void add_event_string(unsigned char **s, int *l, struct terminal *term) { -#ifdef USE_LIBEVENT if (!event_enabled) -#endif add_to_str(s, l, get_text_translation(TEXT_(T_SELECT_SYSCALL), term)); -#ifdef USE_LIBEVENT if (!event_enabled) add_to_str(s, l, cast_uchar " ("); #if defined(HAVE_LIBEV) @@ -434,7 +417,6 @@ void add_event_string(unsigned char **s, int *l, struct terminal *term) add_to_str(s, l, cast_uchar " "); add_to_str(s, l, cast_uchar event_base_get_method(event_base)); } -#endif } @@ -465,24 +447,15 @@ static void check_timers(void) struct timer *install_timer(uttime t, void (*func)(void *), void *data) { struct timer *tm; -#ifdef USE_LIBEVENT - { - unsigned char *q = xmalloc(sizeof_struct_event + sizeof(struct timer)); - tm = (struct timer *)(q + sizeof_struct_event); - } -#else - tm = xmalloc(sizeof(struct timer)); -#endif + unsigned char *q = xmalloc(sizeof_struct_event + sizeof(struct timer)); + tm = (struct timer *)(q + sizeof_struct_event); tm->interval = t; tm->func = func; tm->data = data; -#ifdef USE_LIBEVENT if (event_enabled) { set_event_for_timer(tm); add_to_list(timers, tm); - } else -#endif - { + } else { struct timer *tt = NULL; struct list_head *ltt; foreach(struct timer, tt, ltt, timers) if (tt->interval >= t) break; @@ -494,13 +467,9 @@ struct timer *install_timer(uttime t, void (*func)(void *), void *data) void kill_timer(struct timer *tm) { del_from_list(tm); -#ifdef USE_LIBEVENT if (event_enabled) timeout_del(timer_event(tm)); free(timer_event(tm)); -#else - free(tm); -#endif } void (*get_handler(int fd, int tp))(void *) @@ -530,9 +499,7 @@ void set_handlers_file_line(int fd, void (*read_func)(void *), void (*write_func { if (fd < 0) goto invl; -#if defined(USE_POLL) && defined(USE_LIBEVENT) if (!event_enabled) -#endif if (fd >= (int)FD_SETSIZE) { die("too big handle %d at %s:%d\n", fd, sh_file, sh_line); return; @@ -558,12 +525,10 @@ void set_handlers_file_line(int fd, void (*read_func)(void *), void (*write_func break; w_max = i + 1; } -#ifdef USE_LIBEVENT if (event_enabled) { set_events_for_handle(fd); return; } -#endif if (read_func) FD_SET(fd, &w_read); else { FD_CLR(fd, &w_read); @@ -599,14 +564,11 @@ void clear_events(int h, int blocking) #define NUM_SIGNALS 32 #endif -#ifndef NO_SIGNAL_HANDLERS - static void clear_events_ptr(void *handle) { clear_events((int)(long)handle, 0); } - struct signal_handler { void (*fn)(void *); void *data; @@ -647,8 +609,6 @@ static void got_signal(int sig) static struct sigaction sa_zero; -#endif - void install_signal_handler(int sig, void (*fn)(void *), void *data, int critical) { int rs; @@ -672,7 +632,6 @@ void install_signal_handler(int sig, void (*fn)(void *), void *data, int critica void interruptible_signal(int sig, int in) { -#if !defined(NO_SIGNAL_HANDLERS) struct sigaction sa = sa_zero; int rs; if (sig >= NUM_SIGNALS || sig < 0) { @@ -684,7 +643,6 @@ void interruptible_signal(int sig, int in) sigfillset(&sa.sa_mask); if (!in) sa.sa_flags = SA_RESTART; EINTRLOOP(rs, sigaction(sig, &sa, NULL)); -#endif } static sigset_t sig_old_mask; @@ -728,7 +686,6 @@ void unblock_signals(void) static int check_signals(void) { int r = 0; -#ifndef NO_SIGNAL_HANDLERS int i; for (i = 0; i < NUM_SIGNALS; i++) if (signal_mask[i]) { @@ -740,7 +697,6 @@ static int check_signals(void) CHK_BH; r = 1; } -#endif return r; } @@ -769,58 +725,44 @@ void set_sigcld(void) void reinit_child(void) { -#if !defined(NO_SIGNAL_HANDLERS) signal_pid = getpid(); -#endif -#ifdef USE_LIBEVENT if (event_enabled) { if (event_reinit(event_base)) die("event_reinit: %s\n", strerror(errno)); } -#endif } int terminate_loop = 0; void select_loop(void (*init)(void)) { -#if !defined(USE_LIBEVENT) || !defined(USE_POLL) - restrict_fds(); -#endif -#if !defined(NO_SIGNAL_HANDLERS) memset(&sa_zero, 0, sizeof sa_zero); memset((void *)signal_mask, 0, sizeof signal_mask); memset((void *)signal_handlers, 0, sizeof signal_handlers); -#endif FD_ZERO(&w_read); FD_ZERO(&w_write); w_max = 0; last_time = get_time(); ignore_signals(); -#if !defined(NO_SIGNAL_HANDLERS) signal_pid = getpid(); if (c_pipe(signal_pipe)) die("can't create pipe for signal handling\n"); set_nonblock(signal_pipe[0]); set_nonblock(signal_pipe[1]); set_handlers(signal_pipe[0], clear_events_ptr, NULL, (void *)(long)signal_pipe[0]); -#endif init(); CHK_BH; -#ifdef USE_LIBEVENT #ifdef G if (!F || !(drv->flags & GD_NO_LIBEVENT)) #endif { enable_libevent(); } -#if defined(USE_POLL) if (!event_enabled) { restrict_fds(); } -#endif if (event_enabled) { while (!terminate_loop) { check_signals(); @@ -833,7 +775,6 @@ void select_loop(void (*init)(void)) do_event_loop(EVLOOP_ONCE); } } else -#endif while (!terminate_loop) { volatile int n; /* volatile because of setjmp */ @@ -883,8 +824,6 @@ void select_loop(void (*init)(void)) void terminate_select(void) { -#ifdef USE_LIBEVENT terminate_libevent(); -#endif free(threads); } diff --git a/session.c b/session.c @@ -1995,10 +1995,6 @@ more_data: priint: /* process onload handler of a frameset */ if (rq && (rq->state == O_FAILED || rq->state == O_INCOMPLETE) && (fd->rq == rq || fd->ses->rq == rq) && !rq->dont_print_error) print_error_dialog(fd->ses, &rq->stat, rq->url); -#ifdef LINKS_TESTMODE_DOCUMENT_AUTO_EXIT - if (f_is_finished(fd->f_data)) - terminate_loop = 1; -#endif } static unsigned location_id = 0; diff --git a/setup.h b/setup.h @@ -3,23 +3,6 @@ * This file is a part of the Links program, released under GPL. */ -/* DEBUG LEVEL: - * 0=vsechno vypnuty - * 1=leaky - * 2=leaky, ruda zona - * 3=leaky, ruda zona, alloc, realloc a free patterny - * -1=tajny level ;-) - */ -/* nastavuje se v configure --enable-debuglevel=-1,0,1,2,3 */ - -#define LINKS_SOCK_NAME "socket" -#define LINKS_ANONYMOUS_SOCK_SUFFIX "-a" -#define LINKS_PORT 23755 -#define LINKS_G_PORT_START 32768 -#define LINKS_G_PORT_LEN 16384 -#define MAX_BIND_TRIES 3 -#define AF_UNIX_SOCKET_TIMEOUT 2 - #define FG_POLL_TIME 500 #define DNS_TIMEOUT 3600000UL