Commit: 6cc9d482509bc8f47bb1a70e3e74880b2e24bc5b
Parent: e021d045c00340b94c27549b257b966cfaacffed
Author: opask
Date: Tue, 24 Jul 2018 19:54:45 -0600
remove unused code from os_dep.c
Diffstat:
M | kbd.c | | | 12 | ++++-------- |
M | links.h | | | 10 | ---------- |
M | main.c | | | 4 | ---- |
M | menu.c | | | 11 | ----------- |
M | os_dep.c | | | 61 | ------------------------------------------------------------- |
5 files changed, 4 insertions(+), 94 deletions(-)
diff --git a/kbd.c b/kbd.c
@@ -325,7 +325,7 @@ void handle_trm(int std_in, int std_out, int sock_in, int sock_out, int ctl_in,
ev.y = y;
handle_terminal_resize(ctl_in, resize_terminal);
queue_event(itrm, (unsigned char *)&ev, sizeof(struct links_event));
- xwin = is_xterm() * ENV_XWIN + is_twterm() * ENV_TWIN + is_screen() * ENV_SCREEN + get_system_env();
+ xwin = is_xterm() * ENV_XWIN + is_twterm() * ENV_TWIN + is_screen() * ENV_SCREEN;
itrm->flags = 0;
if (!(ts = cast_uchar getenv("TERM"))) ts = cast_uchar "";
if ((xwin & ENV_TWIN) && !strcmp(cast_const_char ts, "linux")) itrm->flags |= USE_TWIN_MOUSE;
@@ -357,7 +357,7 @@ void handle_trm(int std_in, int std_out, int sock_in, int sock_out, int ctl_in,
itrm->orig_title = get_window_title();
set_window_title(cast_uchar "Links");
send_init_sequence(std_out, itrm->flags);
- itrm->mouse_h = handle_mouse(0, mouse_queue_event, itrm);
+ itrm->mouse_h = NULL;
}
static void unblock_itrm_x(void *h)
@@ -377,8 +377,7 @@ int unblock_itrm(int fd)
send_init_sequence(itrm->std_out, itrm->flags);
set_handlers(itrm->std_in, in_kbd, NULL, itrm);
handle_terminal_resize(itrm->ctl_in, resize_terminal);
- unblock_stdin();
- itrm->mouse_h = handle_mouse(0, mouse_queue_event, itrm);
+ itrm->mouse_h = NULL;
resize_terminal();
return 0;
}
@@ -389,9 +388,8 @@ void block_itrm(int fd)
if (!itrm) return;
if (itrm->blocked) return;
itrm->blocked = fd + 1;
- block_stdin();
unhandle_terminal_resize(itrm->ctl_in);
- if (itrm->mouse_h) unhandle_mouse(itrm->mouse_h), itrm->mouse_h = NULL;
+ itrm->mouse_h = NULL;
send_term_sequence(itrm->std_out, itrm->flags);
setcooked(itrm->ctl_in);
set_handlers(itrm->std_in, NULL, NULL, itrm);
@@ -404,7 +402,6 @@ static void free_trm(struct itrm *itrm)
free(itrm->orig_title);
itrm->orig_title = NULL;
unhandle_terminal_resize(itrm->ctl_in);
- if (itrm->mouse_h) unhandle_mouse(itrm->mouse_h);
send_term_sequence(itrm->std_out, itrm->flags);
setcooked(itrm->ctl_in);
set_handlers(itrm->std_in, NULL, NULL, NULL);
@@ -434,7 +431,6 @@ static void resize_terminal_x(unsigned char *text)
*p++ = 0;
x = atoi(cast_const_char text);
y = atoi(cast_const_char p);
- resize_window(x, y);
resize_terminal();
}
diff --git a/links.h b/links.h
@@ -420,7 +420,6 @@ struct open_in_new {
};
void close_fork_tty(void);
-int get_system_env(void);
int is_twterm(void);
int is_screen(void);
int is_xterm(void);
@@ -447,11 +446,8 @@ void setcooked(int ctl);
#endif
void want_draw(void);
void done_draw(void);
-void terminate_osdep(void);
void save_gpm_signals(void);
void restore_gpm_signals(void);
-void *handle_mouse(int, void (*)(void *, unsigned char *, int), void *);
-void unhandle_mouse(void *);
void add_gpm_version(unsigned char **s, int *l);
int start_thread(void (*)(void *, int), void *, int, int);
unsigned char *get_clipboard_text(struct terminal *);
@@ -470,21 +466,15 @@ void do_signal(int sig, void (*handler)(int));
uttime get_time(void);
uttime get_absolute_time(void);
void ignore_signals(void);
-void block_stdin(void);
-void unblock_stdin(void);
void init_os(void);
-void init_os_terminal(void);
void get_path_to_exe(void);
int os_get_system_name(unsigned char *buffer);
unsigned char *os_conv_to_external_path(unsigned char *, unsigned char *);
unsigned char *os_fixup_external_program(unsigned char *);
int exe(unsigned char *, int);
-int resize_window(int, int);
-int can_resize_window(struct terminal *);
int can_open_os_shell(int);
unsigned char *links_xterm(void);
struct open_in_new *get_open_in_new(int);
-void set_highpri(void);
void os_free_clipboard(void);
diff --git a/main.c b/main.c
@@ -374,9 +374,6 @@ static void init(void)
goto ttt;
}
fixup_g();
- if (!dmp && !ggr) {
- init_os_terminal();
- }
if ((dds.assume_cp = get_cp_index(cast_uchar "ISO-8859-1")) == -1) dds.assume_cp = 0;
load_config();
if (proxies.only_proxies)
@@ -519,7 +516,6 @@ static void terminate_all_subsystems(void)
os_free_clipboard();
if (fg_poll_timer != NULL) kill_timer(fg_poll_timer), fg_poll_timer = NULL;
terminate_select();
- terminate_osdep();
}
int
diff --git a/menu.c b/menu.c
@@ -2968,17 +2968,6 @@ static void do_file_menu(struct terminal *term, void *xxx, void *ses_)
e++;
x = 0;
}
- if (can_resize_window(term)) {
- e->text = TEXT_(T_RESIZE_TERMINAL);
- e->rtext = cast_uchar "";
- e->hotkey = TEXT_(T_HK_RESIZE_TERMINAL);
- e->func = dlg_resize_terminal;
- e->data = NULL;
- e->in_m = 0;
- e->free_i = 0;
- e++;
- x = 0;
- }
memcpy(e, file_menu3 + x, sizeof(file_menu3) - x * sizeof(struct menu_item));
e += sizeof(file_menu3) / sizeof(struct menu_item);
do_menu(term, file_menu, ses);
diff --git a/os_dep.c b/os_dep.c
@@ -9,9 +9,7 @@
#ifdef HAVE_PTHREADS
#include <pthread.h>
-#endif
-#if defined(HAVE_PTHREADS)
static pthread_mutex_t pth_mutex;
static void fd_lock(void);
static void fd_unlock(void);
@@ -26,14 +24,6 @@ static void fd_init(void)
void init_os(void)
{
- /* Disable per-thread heap */
-#if defined(HAVE_MALLOPT) && defined(M_ARENA_TEST)
- mallopt(M_ARENA_TEST, 1);
-#endif
-#if defined(HAVE_MALLOPT) && defined(M_ARENA_MAX)
- mallopt(M_ARENA_MAX, 1);
-#endif
-
#if defined(HAVE_PTHREADS)
{
int r;
@@ -355,24 +345,6 @@ int open_prealloc(unsigned char *name, int flags, int mode, off_t siz)
}
new_fd_bin(h);
fd_unlock();
-#if defined(HAVE_FALLOCATE)
-#if defined(FALLOC_FL_KEEP_SIZE)
- EINTRLOOP(rs, fallocate(h, FALLOC_FL_KEEP_SIZE, 0, siz));
-#else
- EINTRLOOP(rs, fallocate(h, 0, 0, siz));
-#endif
- if (!rs) return h;
-#endif
-#if defined(HAVE_POSIX_FALLOCATE)
- /* posix_fallocate may fall back to overwriting the file with zeros,
- so don't use it on too big files */
- if (siz > 134217728)
- return h;
- do {
- rs = posix_fallocate(h, 0, siz);
- } while (rs == EINTR);
- if (!rs) return h;
-#endif
return h;
}
@@ -441,10 +413,6 @@ void get_path_to_exe(void)
path_to_exe = g_argv[0];
}
-void init_os_terminal(void)
-{
-}
-
unsigned char *os_conv_to_external_path(unsigned char *file, unsigned char *prog)
{
return stracpy(file);
@@ -529,11 +497,6 @@ unsigned char *get_window_title(void)
return NULL;
}
-int resize_window(int x, int y)
-{
- return -1;
-}
-
/* Threads */
#if defined(HAVE_PTHREADS)
@@ -558,13 +521,6 @@ static void bgt(void *t_)
#endif
-void terminate_osdep(void)
-{
-}
-
-void block_stdin(void) {}
-void unblock_stdin(void) {}
-
#if defined(HAVE_PTHREADS)
static unsigned thread_count = 0;
@@ -729,14 +685,6 @@ int get_input_handle(void)
#endif /* defined(HAVE_BEGINTHREAD) && defined(HAVE__READ_KBD) */
-void *handle_mouse(int cons, void (*fn)(void *, unsigned char *, int), void *data) { return NULL; }
-void unhandle_mouse(void *data) { }
-
-int get_system_env(void)
-{
- return 0;
-}
-
static void exec_new_links(struct terminal *term, unsigned char *xterm, unsigned char *exe, unsigned char *param)
{
unsigned char *str;
@@ -846,11 +794,6 @@ struct open_in_new *get_open_in_new(int environment)
return oin;
}
-int can_resize_window(struct terminal *term)
-{
- return 0;
-}
-
int can_open_os_shell(int environment)
{
#ifdef G
@@ -859,10 +802,6 @@ int can_open_os_shell(int environment)
return 1;
}
-void set_highpri(void)
-{
-}
-
void os_seed_random(unsigned char **pool, int *pool_size)
{
*pool = NULL;