From 6c0caf65af338bea40b0820109edd0a69c6886ab Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 18 Jun 2022 07:11:19 +0000 Subject: [PATCH] Remove unused Haiku code * src/haiku_select.cc (be_get_clipboard_targets_1) (be_get_clipboard_targets): Delete functions. (init_haiku_select): Rename to `be_clipboard_init'. Avoid duplicate definition with haikuterm.h. * src/haikuselect.c (init_haiku_select): New function. * src/haikuselect.h: Update prototypes. --- src/haiku_select.cc | 57 +-------------------------------------------- src/haikuselect.c | 6 +++++ src/haikuselect.h | 6 ++--- 3 files changed, 9 insertions(+), 60 deletions(-) diff --git a/src/haiku_select.cc b/src/haiku_select.cc index 764001f62b0..80c5d294820 100644 --- a/src/haiku_select.cc +++ b/src/haiku_select.cc @@ -110,53 +110,6 @@ be_find_clipboard_data_1 (BClipboard *cb, const char *type, ssize_t *len) return (char *) value; } -static void -be_get_clipboard_targets_1 (BClipboard *cb, char **buf, int buf_size) -{ - BMessage *data; - char *name; - int32 count_found; - type_code type; - int32 i; - int index; - - if (!cb->Lock ()) - { - buf[0] = NULL; - return; - } - - data = cb->Data (); - index = 0; - - if (!data) - { - buf[0] = NULL; - cb->Unlock (); - return; - } - - for (i = 0; (data->GetInfo (B_ANY_TYPE, i, &name, - &type, &count_found) - == B_OK); ++i) - { - if (type == B_MIME_TYPE) - { - if (index < (buf_size - 1)) - { - buf[index++] = strdup (name); - - if (!buf[index - 1]) - break; - } - } - } - - buf[index] = NULL; - - cb->Unlock (); -} - static void be_set_clipboard_data_1 (BClipboard *cb, const char *type, const char *data, ssize_t len, bool clear) @@ -227,14 +180,6 @@ be_set_clipboard_data (enum haiku_clipboard id, const char *type, data, len, clear); } -void -be_get_clipboard_targets (enum haiku_clipboard id, char **targets, - int len) -{ - be_get_clipboard_targets_1 (get_clipboard_object (id), targets, - len); -} - static bool clipboard_owner_p (void) { @@ -278,7 +223,7 @@ be_clipboard_owner_p (enum haiku_clipboard clipboard) } void -init_haiku_select (void) +be_clipboard_init (void) { system_clipboard = new BClipboard ("system"); primary = new BClipboard ("primary"); diff --git a/src/haikuselect.c b/src/haikuselect.c index b2783a56a11..96223902f8c 100644 --- a/src/haikuselect.c +++ b/src/haikuselect.c @@ -1014,6 +1014,12 @@ haiku_note_drag_motion (void) haiku_note_drag_motion_2); } +void +init_haiku_select (void) +{ + be_clipboard_init (); +} + void syms_of_haikuselect (void) { diff --git a/src/haikuselect.h b/src/haikuselect.h index e9a2f2dd77d..ac8e0698952 100644 --- a/src/haikuselect.h +++ b/src/haikuselect.h @@ -37,15 +37,12 @@ enum haiku_clipboard #ifdef __cplusplus extern "C" { -/* Also declared in haikuterm.h for use in emacs.c. */ -extern void init_haiku_select (void); #endif -/* Whether or not the selection was recently changed. */ +extern void be_clipboard_init (void); extern char *be_find_clipboard_data (enum haiku_clipboard, const char *, ssize_t *); extern void be_set_clipboard_data (enum haiku_clipboard, const char *, const char *, ssize_t, bool); -extern void be_get_clipboard_targets (enum haiku_clipboard, char **, int); extern bool be_clipboard_owner_p (enum haiku_clipboard); extern void be_update_clipboard_count (enum haiku_clipboard); @@ -64,6 +61,7 @@ extern int be_add_point_data (void *, const char *, float, float); extern int be_add_message_message (void *, const char *, void *); extern int be_lock_clipboard_message (enum haiku_clipboard, void **, bool); extern void be_unlock_clipboard (enum haiku_clipboard, bool); + #ifdef __cplusplus }; #endif -- 2.39.2