aboutsummarylogtreecommitdiffstats
path: root/curses_win.c
diff options
context:
space:
mode:
authorAntony Kellermann2018-09-04 21:43:26 -0400
committerAntony Kellermann2018-09-04 21:43:26 -0400
commitd0ba04661685755e2c92fb97dc0f2331dd02b87c (patch)
tree7f91085a04d166d5b60957834cf7646aa2659d86 /curses_win.c
parent352bdbf1ac8e74b332c99bf9670c1ff89bea8174 (diff)
downloadaur-d0ba04661685755e2c92fb97dc0f2331dd02b87c.tar.gz
Added streq macro
Diffstat (limited to 'curses_win.c')
-rw-r--r--curses_win.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/curses_win.c b/curses_win.c
index a611da435548..6293a2935854 100644
--- a/curses_win.c
+++ b/curses_win.c
@@ -116,7 +116,7 @@ void info_array_portfolio_printw(Info_Array* portfolio_data) {
sort_option++;
portfolio_sort(portfolio_data, sort_option);
for (size_t i = 0; i < portfolio_data->length; i++)
- if (strcmp(portfolio_data->array[i]->symbol, highlight_sym) == 0)
+ if (streq(portfolio_data->array[i]->symbol, highlight_sym))
highlight_index = (int) i; // Make sure the same security stays highlighted
} else sort_option++;
@@ -127,7 +127,7 @@ void info_array_portfolio_printw(Info_Array* portfolio_data) {
sort_option--;
portfolio_sort(portfolio_data, sort_option); // Sort security array
for (size_t i = 0; i < portfolio_data->length; i++)
- if (strcmp(portfolio_data->array[i]->symbol, highlight_sym) == 0)
+ if (streq(portfolio_data->array[i]->symbol, highlight_sym))
highlight_index = (int) i; // Make sure the same security stays highlighted
} else sort_option--;
@@ -153,12 +153,13 @@ void portfolio_print_stock(const char* symbol) {
Json* jobj = json_tokener_parse(pString->data);
size_t i = 0, len = json_object_array_length(jobj);
- while (i < len && strcmp(
- json_object_get_string(json_object_object_get(json_object_array_get_idx(jobj, i), "Symbol")), symbol) != 0)
+ while (i < len && !streq(json_object_get_string(json_object_object_get
+ (json_object_array_get_idx(
+ jobj, i), "Symbol")), symbol))
i++;
if (i == len)
- GOTO_CLEAN_MSG("Your portfolio does not contain any of this security.")
+ GOTO_CLEAN_MSG("Your portfolio does not contain any of this security.")
Info* info = info_init();
strcpy(info->symbol, symbol);
@@ -260,9 +261,9 @@ void header_printw(WINDOW* window, const Info* symbol_info) {
}
void info_print(const Info* symbol_info) {
- if (strcmp(symbol_info->name, "") != 0)
+ if (streq(symbol_info->name, ""))
printf("Name: %s\n", symbol_info->name);
- if (strcmp(symbol_info->symbol, "") != 0)
+ if (streq(symbol_info->symbol, ""))
printf("Symbol: %s\n", symbol_info->symbol);
if (symbol_info->price != EMPTY)
printf("Price: $%lf\n", symbol_info->price);