diff options
author | Antony Kellermann | 2018-07-25 17:54:23 -0400 |
---|---|---|
committer | Antony Kellermann | 2018-07-25 17:54:23 -0400 |
commit | 058c1c9c689edeae8703c3f605eca7f43c867a49 (patch) | |
tree | 460ad8b94f70fc50c5aa1546ae5584d2791b0761 /portfolio.c | |
parent | 8e6ef6d757df7f361e1a5c2ad1d1ccf18616bc01 (diff) | |
download | aur-058c1c9c689edeae8703c3f605eca7f43c867a49.tar.gz |
Fixed function using json_object_get_json_object for some reason
Diffstat (limited to 'portfolio.c')
-rw-r--r-- | portfolio.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/portfolio.c b/portfolio.c index caa9a31783b4..ed80b9ee1bc4 100644 --- a/portfolio.c +++ b/portfolio.c @@ -227,13 +227,12 @@ void portfolio_sort(Info_Array* portfolio_data, int sort_option) { } int portfolio_symbol_index(const char* symbol, const Json* jarray) { - char string[32]; - for (int i = 0; i < (int) json_object_array_length(jarray); i++) { - strcpy(string, json_object_to_json_string( - json_object_object_get(json_object_array_get_idx(jarray, (size_t) i), "Symbol"))); - strip_char(string, '\"'); + for (size_t i = 0; i < json_object_array_length(jarray); i++) { + const char* string = json_object_get_string( + json_object_object_get(json_object_array_get_idx(jarray, (size_t) i), "Symbol")); if (strcmp(string, symbol) == 0) - return i; + return (int) i; } + return -1; }
\ No newline at end of file |