From d04940a1597f2ade5dc9273befea02c1553eec0f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 24 Mar 2016 03:45:16 +0100 Subject: [PATCH] (input_keyboard.c) Refactor more functions into static functions --- input/input_keyboard.c | 29 +++++++---------------------- input/input_keyboard.h | 35 +++++------------------------------ 2 files changed, 12 insertions(+), 52 deletions(-) diff --git a/input/input_keyboard.c b/input/input_keyboard.c index 9763b7225c..6cbc413b05 100644 --- a/input/input_keyboard.c +++ b/input/input_keyboard.c @@ -110,7 +110,7 @@ static input_keyboard_line_t *input_keyboard_line_new(void *userdata, * * Returns: true (1) on success, otherwise false (0). **/ -bool input_keyboard_line_event( +static bool input_keyboard_line_event( input_keyboard_line_t *state, uint32_t character) { char c = character >= 128 ? '?' : character; @@ -157,24 +157,6 @@ bool input_keyboard_line_event( return false; } -/** - * input_keyboard_line_get_buffer: - * @state : Input keyboard line handle. - * - * Gets the underlying buffer of the keyboard line. - * - * The underlying buffer can be reallocated at any time - * (or be NULL), but the pointer to it remains constant - * throughout the objects lifetime. - * - * Returns: pointer to string. - **/ -const char **input_keyboard_line_get_buffer( - const input_keyboard_line_t *state) -{ - return (const char**)&state->buffer; -} - /** * input_keyboard_start_line: * @userdata : Userdata. @@ -182,8 +164,11 @@ const char **input_keyboard_line_get_buffer( * * Sets function pointer for keyboard line handle. * - * Returns: underlying buffer returned by - * input_keyboard_line_get_buffer(). + * The underlying buffer can be reallocated at any time + * (or be NULL), but the pointer to it remains constant + * throughout the objects lifetime. + * + * Returns: underlying buffer of the keyboard line. **/ const char **input_keyboard_start_line(void *userdata, input_keyboard_line_complete_t cb) @@ -195,7 +180,7 @@ const char **input_keyboard_start_line(void *userdata, /* While reading keyboard line input, we have to block all hotkeys. */ input_driver_keyboard_mapping_set_block(true); - return input_keyboard_line_get_buffer(g_keyboard_line); + return (const char**)&g_keyboard_line->buffer; } /** diff --git a/input/input_keyboard.h b/input/input_keyboard.h index b2f6268313..50bf53f602 100644 --- a/input/input_keyboard.h +++ b/input/input_keyboard.h @@ -66,34 +66,6 @@ typedef struct input_keyboard_ctx_wait input_keyboard_press_t cb; } input_keyboard_ctx_wait_t; - -/** - * input_keyboard_line_event: - * @state : Input keyboard line handle. - * @character : Inputted character. - * - * Called on every keyboard character event. - * - * Returns: true (1) on success, otherwise false (0). - **/ -bool input_keyboard_line_event(input_keyboard_line_t *state, - uint32_t character); - -/** - * input_keyboard_line_get_buffer: - * @state : Input keyboard line handle. - * - * Gets the underlying buffer of the keyboard line. - * - * The underlying buffer can be reallocated at any time - * (or be NULL), but the pointer to it remains constant - * throughout the objects lifetime. - * - * Returns: pointer to string. - **/ -const char **input_keyboard_line_get_buffer( - const input_keyboard_line_t *state); - /** * input_keyboard_event: * @down : Keycode was pressed down? @@ -114,8 +86,11 @@ void input_keyboard_event(bool down, unsigned code, uint32_t character, * * Sets function pointer for keyboard line handle. * - * Returns: underlying buffer returned by - * input_keyboard_line_get_buffer(). + * The underlying buffer can be reallocated at any time + * (or be NULL), but the pointer to it remains constant + * throughout the objects lifetime. + * + * Returns: underlying buffer of the keyboard line. **/ const char **input_keyboard_start_line(void *userdata, input_keyboard_line_complete_t cb);