Fix file descriptor leaks if init_file_download fails
[elinks/elinks-j605.git] / src / document / view.h
blobf800d8365b0de1dc61fe795c797add54011d6a72
1 #ifndef EL__DOCUMENT_VIEW_H
2 #define EL__DOCUMENT_VIEW_H
4 #include "terminal/draw.h"
5 #include "util/lists.h"
6 #include "util/box.h"
9 struct document;
10 struct view_state;
12 struct document_view {
13 LIST_HEAD(struct document_view);
15 unsigned char *name;
16 unsigned char **search_word;
18 struct session *session;
19 struct document *document;
20 struct view_state *vs;
22 struct box box; /**< pos and size of window */
23 int last_x, last_y; /**< last pos of window */
24 int depth;
25 int used;
28 #define get_old_current_link(doc_view) \
29 (((doc_view) \
30 && (doc_view)->vs->old_current_link >= 0 \
31 && (doc_view)->vs->old_current_link < (doc_view)->document->nlinks) \
32 ? &(doc_view)->document->links[(doc_view)->vs->old_current_link] : NULL)
34 #define get_current_link(doc_view) \
35 (((doc_view) \
36 && (doc_view)->vs->current_link >= 0 \
37 && (doc_view)->vs->current_link < (doc_view)->document->nlinks) \
38 ? &(doc_view)->document->links[(doc_view)->vs->current_link] : NULL)
40 #endif