summaryrefslogtreecommitdiff
path: root/noncore/todayplugins/stockticker/libstocks/stocks.c
Unidiff
Diffstat (limited to 'noncore/todayplugins/stockticker/libstocks/stocks.c') (more/less context) (show whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/libstocks/stocks.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/noncore/todayplugins/stockticker/libstocks/stocks.c b/noncore/todayplugins/stockticker/libstocks/stocks.c
index eb04ba9..3a26a47 100644
--- a/noncore/todayplugins/stockticker/libstocks/stocks.c
+++ b/noncore/todayplugins/stockticker/libstocks/stocks.c
@@ -237,7 +237,6 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas)
237 switch (source) 237 switch (source)
238 { 238 {
239 case YAHOO_US: 239 case YAHOO_US:
240
241 if (us_quotes) 240 if (us_quotes)
242 { 241 {
243 lgr_us_quotes = strlen(us_quotes); 242 lgr_us_quotes = strlen(us_quotes);
@@ -246,8 +245,8 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas)
246 us_quotes_temp = malloc(lgr_us_quotes + lgr_symbol +2); 245 us_quotes_temp = malloc(lgr_us_quotes + lgr_symbol +2);
247 if(us_quotes_temp==NULL) 246 if(us_quotes_temp==NULL)
248 { 247 {
249 fprintf(stderr,"Memory allocating error (%s line %d)\n" 248 fprintf(stderr,"Memory allocating error (%s line %d)\n",
250 ,__FILE__, __LINE__); 249 __FILE__, __LINE__);
251 exit(1); 250 exit(1);
252 } 251 }
253 strcpy(us_quotes_temp, us_quotes); 252 strcpy(us_quotes_temp, us_quotes);
@@ -263,8 +262,8 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas)
263 262
264 if(us_quotes==NULL) 263 if(us_quotes==NULL)
265 { 264 {
266 fprintf(stderr,"Memory allocating error (%s line %d)\n" 265 fprintf(stderr,"Memory allocating error (%s line %d)\n",
267 ,__FILE__, __LINE__); 266 __FILE__, __LINE__);
268 exit(1); 267 exit(1);
269 } 268 }
270 strcpy(us_quotes, symbol); 269 strcpy(us_quotes, symbol);
@@ -273,7 +272,6 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas)
273 break; 272 break;
274 273
275 case YAHOO_EUROPE: 274 case YAHOO_EUROPE:
276
277 if (eu_quotes) 275 if (eu_quotes)
278 { 276 {
279 lgr_eu_quotes = strlen(eu_quotes); 277 lgr_eu_quotes = strlen(eu_quotes);
@@ -282,8 +280,8 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas)
282 eu_quotes_temp = malloc(lgr_eu_quotes + lgr_symbol +2); 280 eu_quotes_temp = malloc(lgr_eu_quotes + lgr_symbol +2);
283 if(eu_quotes_temp==NULL) 281 if(eu_quotes_temp==NULL)
284 { 282 {
285 fprintf(stderr,"Memory allocating error (%s line %d)\n" 283 fprintf(stderr,"Memory allocating error (%s line %d)\n",
286 ,__FILE__, __LINE__); 284 __FILE__, __LINE__);
287 exit(1); 285 exit(1);
288 } 286 }
289 strcpy(eu_quotes_temp, eu_quotes); 287 strcpy(eu_quotes_temp, eu_quotes);
@@ -298,8 +296,8 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas)
298 eu_quotes = malloc(strlen(symbol)+1); 296 eu_quotes = malloc(strlen(symbol)+1);
299 if(eu_quotes==NULL) 297 if(eu_quotes==NULL)
300 { 298 {
301 fprintf(stderr,"Memory allocating error (%s line %d)\n" 299 fprintf(stderr,"Memory allocating error (%s line %d)\n",
302 ,__FILE__, __LINE__); 300 __FILE__, __LINE__);
303 exit(1); 301 exit(1);
304 } 302 }
305 strcpy(eu_quotes, symbol); 303 strcpy(eu_quotes, symbol);
@@ -314,6 +312,7 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas)
314 { 312 {
315 /* Gets us quotes */ 313 /* Gets us quotes */
316 error = download_stocks(us_quotes, &stocks_tmp, YAHOO_US); 314 error = download_stocks(us_quotes, &stocks_tmp, YAHOO_US);
315 free(us_quotes);
317 if (error) return error; 316 if (error) return error;
318 } 317 }
319 318
@@ -321,6 +320,7 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas)
321 { 320 {
322 /* Gets european quotes */ 321 /* Gets european quotes */
323 error = download_stocks(eu_quotes, &stocks_getted, YAHOO_EUROPE); 322 error = download_stocks(eu_quotes, &stocks_getted, YAHOO_EUROPE);
323 free(eu_quotes);
324 if (error) return error; 324 if (error) return error;
325 325
326 /* concats lists if needed */ 326 /* concats lists if needed */
@@ -338,7 +338,8 @@ libstocks_return_code get_stocks(const char *stocks, stock **stock_datas)
338 stocks_getted->PreviousStock = last_stock; 338 stocks_getted->PreviousStock = last_stock;
339 339
340 } 340 }
341 else (stocks_tmp = stocks_getted); 341 else
342 (stocks_tmp = stocks_getted);
342 } 343 }
343 344
344 *stock_datas = stocks_tmp; 345 *stock_datas = stocks_tmp;