1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Removed unused boolean result from autocomplete add and remove

This commit is contained in:
James Booth 2013-12-09 23:51:13 +00:00
parent ef6515f078
commit 0de1ff9b4d
3 changed files with 8 additions and 45 deletions

View File

@ -82,7 +82,7 @@ autocomplete_length(Autocomplete ac)
}
}
gboolean
void
autocomplete_add(Autocomplete ac, const char *item)
{
char *item_cpy;
@ -90,21 +90,21 @@ autocomplete_add(Autocomplete ac, const char *item)
// if item already exists
if (curr != NULL) {
return FALSE;
return;
}
item_cpy = strdup(item);
ac->items = g_slist_insert_sorted(ac->items, item_cpy, (GCompareFunc)strcmp);
return TRUE;
return;
}
gboolean
void
autocomplete_remove(Autocomplete ac, const char * const item)
{
GSList *curr = g_slist_find_custom(ac->items, item, (GCompareFunc)strcmp);
if (!curr) {
return FALSE;
return;
}
// reset last found if it points to the item to be removed
@ -115,7 +115,7 @@ autocomplete_remove(Autocomplete ac, const char * const item)
free(curr->data);
ac->items = g_slist_delete_link(ac->items, curr);
return TRUE;
return;
}
GSList *

View File

@ -32,8 +32,8 @@ Autocomplete autocomplete_new(void);
void autocomplete_clear(Autocomplete ac);
void autocomplete_reset(Autocomplete ac);
void autocomplete_free(Autocomplete ac);
gboolean autocomplete_add(Autocomplete ac, const char *item);
gboolean autocomplete_remove(Autocomplete ac, const char * const item);
void autocomplete_add(Autocomplete ac, const char *item);
void autocomplete_remove(Autocomplete ac, const char * const item);
GSList * autocomplete_get_list(Autocomplete ac);
gchar * autocomplete_complete(Autocomplete ac, gchar *search_str);
gint autocomplete_length(Autocomplete ac);

View File

@ -113,40 +113,6 @@ static void add_two_same_updates(void)
autocomplete_clear(ac);
}
static void add_one_returns_true(void)
{
Autocomplete ac = autocomplete_new();
int result = autocomplete_add(ac, "Hello");
assert_true(result);
autocomplete_clear(ac);
}
static void add_two_different_returns_true(void)
{
Autocomplete ac = autocomplete_new();
int result1 = autocomplete_add(ac, "Hello");
int result2 = autocomplete_add(ac, "Hello there");
assert_true(result1);
assert_true(result2);
autocomplete_clear(ac);
}
static void add_two_same_returns_false(void)
{
Autocomplete ac = autocomplete_new();
int result1 = autocomplete_add(ac, "Hello");
int result2 = autocomplete_add(ac, "Hello");
assert_true(result1);
assert_false(result2);
autocomplete_clear(ac);
}
void register_autocomplete_tests(void)
{
TEST_MODULE("autocomplete tests");
@ -160,7 +126,4 @@ void register_autocomplete_tests(void)
TEST(add_two_adds_two);
TEST(add_two_same_adds_one);
TEST(add_two_same_updates);
TEST(add_one_returns_true);
TEST(add_two_different_returns_true);
TEST(add_two_same_returns_false);
}