projects
/
prss.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(no commit message)
[prss.git]
/
src
/
ttrss.c
diff --git
a/src/ttrss.c
b/src/ttrss.c
index
99b8bc4
..
1f97155
100644
(file)
--- a/
src/ttrss.c
+++ b/
src/ttrss.c
@@
-214,6
+214,7
@@
int ws_update_headlines(struct feed *feed)
struct json_object *rp, *rq, *jheadline, *j;
int i, n, err, hid;
struct headline *h, **tmp;
struct json_object *rp, *rq, *jheadline, *j;
int i, n, err, hid;
struct headline *h, **tmp;
+ const char *title, *url;
rq = ws_request_new("getHeadlines");
ws_request_add_att_int(rq, "feed_id", feed->id);
rq = ws_request_new("getHeadlines");
ws_request_add_att_int(rq, "feed_id", feed->id);
@@
-232,12
+233,13
@@
int ws_update_headlines(struct feed *feed)
h = feed_get_headline(feed, hid);
if (!h) {
h = feed_get_headline(feed, hid);
if (!h) {
- h = malloc(sizeof(struct headline));
- h->id = hid;
- h->excerpt = NULL;
- h->content = NULL;
- h->title = NULL;
- h->url = NULL;
+ j = json_object_object_get(jheadline, "title");
+ title = json_object_get_string(j);
+
+ j = json_object_object_get(jheadline, "link");
+ url = json_object_get_string(j);
+
+ h = headline_new(hid, url, title);
tmp = headlines_add(feed->headlines, h);
if (feed->headlines)
tmp = headlines_add(feed->headlines, h);
if (feed->headlines)
@@
-245,16
+247,6
@@
int ws_update_headlines(struct feed *feed)
feed->headlines = tmp;
}
feed->headlines = tmp;
}
- if (!h->title) {
- j = json_object_object_get(jheadline, "title");
- h->title = strdup(json_object_get_string(j));
- }
-
- if (!h->url) {
- j = json_object_object_get(jheadline, "link");
- h->url = strdup(json_object_get_string(j));
- }
-
j = json_object_object_get(jheadline, "unread");
h->unread = json_object_get_boolean(j);
}
j = json_object_object_get(jheadline, "unread");
h->unread = json_object_get_boolean(j);
}