blob: 5e269e0865c7637ad25751542053797640218d11 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include "quotes.h"
#include <stdlib.h>
#include <string.h>
void quote_free(struct quote *q)
{
free(q->symbol);
free(q->currency);
free(q);
}
struct quote *quote_find(struct quote **quotes, int n_quotes,
const char *symbol, const char *currency)
{
for (int i = 0; i < n_quotes; ++i) {
if (strcmp(quotes[i]->symbol, symbol) == 0 &&
strcmp(quotes[i]->currency, currency) == 0)
return quotes[i];
}
return NULL;
}
|