чување 77190609396831980b82c1a8f32ee2b4cb7132a1
родитељ efef9a1ff419639b3f57e61b35ed87590573748c
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Thu, 24 Feb 2022 22:07:33 +0100
poe.c: Remove unnecessary checks
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
| M | poe.c | | | 32 | -------------------------------- |
измењених датотека: 1, додавања: 0(+), брисања: 32(-)
diff --git a/poe.c b/poe.c
@@ -61,9 +61,6 @@ print_error(const int code, const char* msg, ...)
int
write_file(struct DrawState* state)
{
- if (!state)
- return 1;
-
int result = save_file(state->entries, state->real_msgid_count,
state->filename, state->nplurals);
switch (result)
@@ -90,9 +87,6 @@ write_file(struct DrawState* state)
void
overwrite_copy_msgid_callback(struct DrawState* state, struct tb_event* ev)
{
- if (!state)
- return;
-
if (ev->ch == 'y')
copy_msgid_to_input(state);
state->prompt_callback = NULL;
@@ -101,9 +95,6 @@ overwrite_copy_msgid_callback(struct DrawState* state, struct tb_event* ev)
void
overwrite_paste_callback(struct DrawState* state, struct tb_event* ev)
{
- if (!state)
- return;
-
if (ev->ch == 'y')
paste_paste_buffer_to_input(state);
state->prompt_callback = NULL;
@@ -112,9 +103,6 @@ overwrite_paste_callback(struct DrawState* state, struct tb_event* ev)
void
cancel_callback(struct DrawState* state, struct tb_event* ev)
{
- if (!state)
- return;
-
if (ev->ch == 'y')
save_msgstr(state);
else
@@ -125,9 +113,6 @@ cancel_callback(struct DrawState* state, struct tb_event* ev)
void
quit_callback(struct DrawState* state, struct tb_event* ev)
{
- if (!state)
- return;
-
if (ev->ch == 'y')
write_file(state);
state->prompt_callback = NULL;
@@ -137,9 +122,6 @@ quit_callback(struct DrawState* state, struct tb_event* ev)
int
cancel_close(struct DrawState* state)
{
- if (!state)
- return 1;
-
*state->error = 0;
if (state->in_prompt)
{
@@ -441,9 +423,6 @@ save_msgstr(struct DrawState* state)
size_t to_save_size = 0;
struct PoEntry* current = NULL;
- if (!state)
- return 1;
-
state->show_edit = 0;
state->edit_info_focused = 0;
@@ -1675,8 +1654,6 @@ move_list_page_down(struct DrawState* state)
int
next_plural(struct DrawState* state)
{
- if (!state)
- return 1;
if (state->edit_info_focused)
return 0;
struct PoEntry* current = &state->entries[state->msgid_number - 1];
@@ -1690,8 +1667,6 @@ next_plural(struct DrawState* state)
int
prev_plural(struct DrawState* state)
{
- if (!state)
- return 1;
if (state->edit_info_focused)
return 0;
save_msgstr(state);
@@ -1704,8 +1679,6 @@ prev_plural(struct DrawState* state)
int
toggle_fuzzy(struct DrawState* state)
{
- if (!state)
- return 1;
if (state->msgid_number == 1)
{
strcpy(state->error, errors[ERR_ILLEGAL_ON_FIRST]);
@@ -1950,9 +1923,6 @@ insert_line(struct DrawState* state)
struct DrawState*
join_lines(struct DrawState* state, size_t first_line, int forward)
{
- if (!state)
- return NULL;
-
state->input_column = state->input_buffer[first_line].length;
state->input_display_column = display_length(state,
state->input_buffer[state->input_row].text,
@@ -1990,8 +1960,6 @@ void
handle_key_event(struct tb_event* ev, struct DrawState* state)
{
const struct Key* current = NULL;
- if (!state)
- return;
if (state->in_prompt)
{