1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Declare element types of lists.

This commit is contained in:
Kalle Olavi Niemitalo 2007-07-26 22:39:08 +03:00 committed by Kalle Olavi Niemitalo
parent d3d2bb26c5
commit 96176a8c77
70 changed files with 188 additions and 156 deletions

View File

@ -45,7 +45,7 @@ elinks: $(LIB_O_NAME) vernum.o
TAGS:
cd $(srcdir) \
&& find . \( -name "*.[ch]" -o -name "*.inc" \) -print \
| etags --regex='{c}/INIT_LIST_HEAD(\([[:alnum:]_]+\))/\1/' \
| etags --regex='{c}/INIT_LIST_OF([^,]*,[ \t]*\([[:alnum:]_]+\))/\1/' \
--regex='{c}/struct_hierbox_browser(\n[ \t]*\([[:alnum:]_]+\),/\1/m' \
--regex='{c}/^ACTION_(\([[:alnum:]_]+\),[^,]*,[ \t]*\([[:alnum:]_]+\),/ACT_\1_\2/' \
--language=c -

View File

@ -21,8 +21,8 @@ struct hierbox_browser {
const struct hierbox_browser_button *buttons;
size_t buttons_size;
struct list_head boxes;
struct list_head dialogs;
LIST_OF(struct listbox_data) boxes;
LIST_OF(struct hierbox_dialog_list_item) dialogs;
struct listbox_item root;
const struct listbox_ops *ops;

View File

@ -30,7 +30,7 @@ struct widget_info_field {
struct widget_data_info_field {
int vpos;
int cpos;
struct list_head history;
LIST_OF(struct input_history_entry) history;
struct input_history_entry *cur_hist;
};

View File

@ -58,7 +58,8 @@ menu_tab_compl(struct terminal *term, void *item_, void *dlg_data_)
/* Complete to last unambiguous character, and display menu for all possible
* further completions. */
void
do_tab_compl(struct dialog_data *dlg_data, struct list_head *history)
do_tab_compl(struct dialog_data *dlg_data,
LIST_OF(struct input_history_entry) *history)
{
struct terminal *term = dlg_data->win->term;
struct widget_data *widget_data = selected_widget(dlg_data);
@ -104,7 +105,8 @@ strcommonlen(unsigned char *a, unsigned char *b)
* completes `go' to `google.com' and `google.com/' to `google.com/search?q='.
*/
void
do_tab_compl_unambiguous(struct dialog_data *dlg_data, struct list_head *history)
do_tab_compl_unambiguous(struct dialog_data *dlg_data,
LIST_OF(struct input_history_entry) *history)
{
struct string completion;
struct widget_data *widget_data = selected_widget(dlg_data);
@ -188,7 +190,8 @@ tab_complete_file_menu(struct terminal *term, void *path_, void *dlg_data_)
}
void
do_tab_compl_file(struct dialog_data *dlg_data, struct list_head *history)
do_tab_compl_file(struct dialog_data *dlg_data,
LIST_OF(struct input_history_entry) *history)
{
struct widget_data *widget_data = selected_widget(dlg_data);

View File

@ -12,7 +12,7 @@ struct input_history_entry {
};
struct input_history {
struct list_head entries;
LIST_OF(struct input_history_entry) entries;
int size;
unsigned int dirty:1;
unsigned int nosave:1;
@ -42,9 +42,12 @@ struct input_history {
void add_to_input_history(struct input_history *, unsigned char *, int);
void do_tab_compl(struct dialog_data *, struct list_head *);
void do_tab_compl_file(struct dialog_data *, struct list_head *);
void do_tab_compl_unambiguous(struct dialog_data *, struct list_head *);
void do_tab_compl(struct dialog_data *,
LIST_OF(struct input_history_entry) *);
void do_tab_compl_file(struct dialog_data *,
LIST_OF(struct input_history_entry) *);
void do_tab_compl_unambiguous(struct dialog_data *,
LIST_OF(struct input_history_entry) *);
/* Load history file from elinks home. */
int load_input_history(struct input_history *history, unsigned char *filename);

View File

@ -407,7 +407,7 @@ display_listbox_item(struct listbox_item *item, void *data_, int *offset)
str[1] = BORDER_SDLCORNER;
}
} else {
struct list_head *p = data->box->items;
LIST_OF(struct listbox_item) *p = data->box->items;
if (p->next == item) {
str[1] = BORDER_SULCORNER;

View File

@ -105,7 +105,7 @@ struct listbox_data {
struct listbox_item *top; /* Item which is on the top line of the box */
int sel_offset; /* Offset of selected item against the box top */
struct list_head *items; /* The list being displayed */
LIST_OF(struct listbox_item) *items; /* The list being displayed */
};
enum listbox_item_type {
@ -119,7 +119,7 @@ struct listbox_item {
LIST_HEAD(struct listbox_item);
/* The list may be empty for leaf nodes or non-hiearchic listboxes */
struct list_head child;
LIST_OF(struct listbox_item) child;
enum listbox_item_type type;
int depth;

View File

@ -74,7 +74,7 @@ bookmarks_read(void)
}
void
bookmarks_write(struct list_head *bookmarks_list)
bookmarks_write(LIST_OF(struct bookmark) *bookmarks_list)
{
int backend_num = get_opt_int("bookmarks.file_format");
struct bookmarks_backend *backend = bookmarks_backends[backend_num];

View File

@ -10,10 +10,10 @@ struct bookmarks_backend {
/* Order matters here. --Zas. */
unsigned char *(*filename)(int);
void (*read)(FILE *);
void (*write)(struct secure_save_info *, struct list_head *);
void (*write)(struct secure_save_info *, LIST_OF(struct bookmark) *);
};
void bookmarks_read(void);
void bookmarks_write(struct list_head *);
void bookmarks_write(LIST_OF(struct bookmark) *);
#endif

View File

@ -128,7 +128,7 @@ read_bookmarks_default(FILE *f)
/* Saves the bookmarks to file */
static void
write_bookmarks_default(struct secure_save_info *ssi,
struct list_head *bookmarks_list)
LIST_OF(struct bookmark) *bookmarks_list)
{
int folder_state = get_opt_bool("bookmarks.folder_state");
struct bookmark *bm;

View File

@ -58,10 +58,10 @@ static unsigned char * filename_bookmarks_xbel(int writing);
static int xbeltree_to_bookmarks_list(struct tree_node *root,
struct bookmark *current_parent);
static void write_bookmarks_list(struct secure_save_info *ssi,
struct list_head *bookmarks_list,
LIST_OF(struct bookmark) *bookmarks_list,
int n, int folder_state);
static void write_bookmarks_xbel(struct secure_save_info *ssi,
struct list_head *bookmarks_list);
LIST_OF(struct bookmark) *bookmarks_list);
/* Element */
struct tree_node {
@ -134,7 +134,7 @@ read_bookmarks_xbel(FILE *f)
static void
write_bookmarks_xbel(struct secure_save_info *ssi,
struct list_head *bookmarks_list)
LIST_OF(struct bookmarks) *bookmarks_list)
{
int folder_state = get_opt_bool("bookmarks.folder_state");
/* We check for readok in filename_bookmarks_xbel(). */
@ -208,7 +208,7 @@ print_xml_entities(struct secure_save_info *ssi, const unsigned char *str)
static void
write_bookmarks_list(struct secure_save_info *ssi,
struct list_head *bookmarks_list,
LIST_OF(struct bookmark) *bookmarks_list,
int n, int folder_state)
{
struct bookmark *bm;

View File

@ -32,7 +32,7 @@
#include "util/string.h"
/* The list of bookmarks */
INIT_LIST_HEAD(bookmarks);
INIT_LIST_OF(struct bookmark, bookmarks);
/* Set to 1, if bookmarks have changed. */
static int bookmarks_dirty = 0;
@ -147,8 +147,8 @@ init_bookmarks(struct module *module)
/* Clears the bookmark list */
static void
free_bookmarks(struct list_head *bookmarks_list,
struct list_head *box_items)
free_bookmarks(LIST_OF(struct bookmark) *bookmarks_list,
LIST_OF(struct listbox_item) *box_items)
{
struct bookmark *bm;
@ -441,7 +441,7 @@ struct bookmark *
get_bookmark_by_name(struct bookmark *folder, unsigned char *title)
{
struct bookmark *bookmark;
struct list_head *lh;
LIST_OF(struct bookmark) *lh;
lh = folder ? &folder->child : &bookmarks;

View File

@ -20,7 +20,7 @@ struct bookmark {
unsigned char *title; /* title of bookmark */
unsigned char *url; /* Location of bookmarked item */
struct list_head child;
LIST_OF(struct bookmark) child;
};
/* Bookmark lists */

View File

@ -344,7 +344,7 @@ enum move_bookmark_flags {
* _into_ dest or, if insert_as_child is 0, _after_ dest. */
static enum move_bookmark_flags
do_move_bookmark(struct bookmark *dest, int insert_as_child,
struct list_head *src, struct listbox_data *box)
LIST_OF(struct bookmark) *src, struct listbox_data *box)
{
static int move_bookmark_event_id = EVENT_NONE;
struct bookmark *bm, *next;

2
src/cache/cache.c vendored
View File

@ -24,7 +24,7 @@
#include "util/time.h"
/* The list of cache entries */
static INIT_LIST_HEAD(cache_entries);
static INIT_LIST_OF(struct cache_entry, cache_entries);
static unsigned longlong cache_size;
static int id_counter = 1;

View File

@ -45,7 +45,7 @@ static unsigned char *remote_url;
static enum retval
parse_options_(int argc, unsigned char *argv[], struct option *opt,
struct list_head *url_list)
LIST_OF(struct string_list_item) *url_list)
{
while (argc) {
argv++, argc--;
@ -116,7 +116,8 @@ unknown_option:
}
enum retval
parse_options(int argc, unsigned char *argv[], struct list_head *url_list)
parse_options(int argc, unsigned char *argv[],
LIST_OF(struct string_list_item) *url_list)
{
return parse_options_(argc, argv, cmdline_options, url_list);
}

View File

@ -4,6 +4,7 @@
#include "main/main.h"
#include "util/lists.h"
enum retval parse_options(int, unsigned char *[], struct list_head *);
enum retval parse_options(int, unsigned char *[],
LIST_OF(struct string_list_item) *);
#endif

View File

@ -52,7 +52,7 @@
* (struct option *) instead. This applies to bookmarks, global history and
* listbox items as well, though. --pasky */
static INIT_LIST_HEAD(options_root_tree);
static INIT_LIST_OF(struct option, options_root_tree);
static struct option options_root = INIT_OPTION(
/* name: */ "",
@ -68,7 +68,7 @@ struct option *config_options;
struct option *cmdline_options;
static void add_opt_rec(struct option *, unsigned char *, struct option *);
static void free_options_tree(struct list_head *, int recursive);
static void free_options_tree(LIST_OF(struct option) *, int recursive);
#ifdef CONFIG_DEBUG
/* Detect ending '.' (and some others) in options captions.
@ -305,8 +305,8 @@ get_opt_(
static void
add_opt_sort(struct option *tree, struct option *option, int abi)
{
struct list_head *cat = tree->value.tree;
struct list_head *bcat = &tree->box_item->child;
LIST_OF(struct option) *cat = tree->value.tree;
LIST_OF(struct listbox_item) *bcat = &tree->box_item->child;
struct option *pos;
/* The list is empty, just add it there. */
@ -477,7 +477,7 @@ add_opt(struct option *tree, unsigned char *path, unsigned char *capt,
mem_free(option);
return NULL;
}
option->value.tree = (struct list_head *) value;
option->value.tree = (LIST_OF(struct option) *) value;
break;
case OPT_STRING:
if (!value) {
@ -642,10 +642,10 @@ copy_option(struct option *template)
return option;
}
struct list_head *
LIST_OF(struct option) *
init_options_tree(void)
{
struct list_head *ptr = mem_alloc(sizeof(*ptr));
LIST_OF(struct option) *ptr = mem_alloc(sizeof(*ptr));
if (ptr) init_list(*ptr);
return ptr;
@ -700,7 +700,7 @@ init_options(void)
}
static void
free_options_tree(struct list_head *tree, int recursive)
free_options_tree(LIST_OF(struct option) *tree, int recursive)
{
while (!list_empty(*tree))
delete_option_do(tree->next, recursive);
@ -730,7 +730,7 @@ register_change_hooks(const struct change_hook_info *change_hooks)
}
void
unmark_options_tree(struct list_head *tree)
unmark_options_tree(LIST_OF(struct option) *tree)
{
struct option *option;
@ -742,7 +742,7 @@ unmark_options_tree(struct list_head *tree)
}
void
watermark_deleted_options(struct list_head *tree)
watermark_deleted_options(LIST_OF(struct option) *tree)
{
struct option *option;
@ -755,7 +755,7 @@ watermark_deleted_options(struct list_head *tree)
}
static int
check_nonempty_tree(struct list_head *options)
check_nonempty_tree(LIST_OF(struct option) *options)
{
struct option *opt;
@ -773,7 +773,8 @@ check_nonempty_tree(struct list_head *options)
void
smart_config_string(struct string *str, int print_comment, int i18n,
struct list_head *options, unsigned char *path, int depth,
LIST_OF(struct option) *options,
unsigned char *path, int depth,
void (*fn)(struct string *, struct option *,
unsigned char *, int, int, int, int))
{
@ -917,7 +918,7 @@ change_hook_ui(struct session *ses, struct option *current, struct option *chang
/* Bit 2 of show means we should always set visibility, otherwise we set it
* only on templates. */
static void
update_visibility(struct list_head *tree, int show)
update_visibility(LIST_OF(struct option) *tree, int show)
{
struct option *opt;

View File

@ -142,7 +142,7 @@ struct option {
};
#define INIT_OPTION(name, flags, type, min, max, value, desc, capt) \
{ NULL_LIST_HEAD, INIT_OBJECT("option"), name, flags, type, min, max, { (struct list_head *) (value) }, desc, capt }
{ NULL_LIST_HEAD, INIT_OBJECT("option"), name, flags, type, min, max, { (LIST_OF(struct option) *) (value) }, desc, capt }
extern struct option *config_options;
extern struct option *cmdline_options;
@ -160,12 +160,14 @@ struct change_hook_info {
extern void register_change_hooks(const struct change_hook_info *change_hooks);
extern struct list_head *init_options_tree(void);
extern void unmark_options_tree(struct list_head *);
void watermark_deleted_options(struct list_head *);
extern LIST_OF(struct option) *init_options_tree(void);
extern void unmark_options_tree(LIST_OF(struct option) *);
void watermark_deleted_options(LIST_OF(struct option) *);
extern void smart_config_string(struct string *, int, int, struct list_head *, unsigned char *, int,
void (*)(struct string *, struct option *, unsigned char *, int, int, int, int));
extern void smart_config_string(struct string *, int, int,
LIST_OF(struct option) *, unsigned char *, int,
void (*)(struct string *, struct option *,
unsigned char *, int, int, int, int));
extern struct option *copy_option(struct option *);
extern void delete_option(struct option *);

View File

@ -368,8 +368,8 @@ color_wr(struct option *opt, struct string *str)
static void
tree_dup(struct option *opt, struct option *template)
{
struct list_head *new = init_options_tree();
struct list_head *tree = template->value.tree;
LIST_OF(struct option) *new = init_options_tree();
LIST_OF(struct option) *tree = template->value.tree;
struct option *option;
if (!new) return;

View File

@ -51,7 +51,7 @@
static int cookies_nosave = 0;
static INIT_LIST_HEAD(cookies);
static INIT_LIST_OF(struct cookie, cookies);
struct c_domain {
LIST_HEAD(struct c_domain);
@ -64,11 +64,10 @@ struct c_domain {
* struct c_domain. No other data structures have pointers to these
* objects. Currently the domains remain in the list until
* @done_cookies clears the whole list. */
static INIT_LIST_HEAD(c_domains);
static INIT_LIST_OF(struct c_domain, c_domains);
/* List of servers for which there are cookies. Each element is a
* struct cookie_server. */
static INIT_LIST_HEAD(cookie_servers);
/* List of servers for which there are cookies. */
static INIT_LIST_OF(struct cookie_server, cookie_servers);
/* Only @set_cookies_dirty may make this nonzero. */
static int cookies_dirty = 0;
@ -908,7 +907,7 @@ init_cookies(struct module *module)
/* Like @delete_cookie, this function does not set @cookies_dirty.
* The caller must do that if appropriate. */
static void
free_cookies_list(struct list_head *list)
free_cookies_list(LIST_OF(struct cookie) *list)
{
while (!list_empty(*list)) {
struct cookie *cookie = list->next;

View File

@ -25,7 +25,7 @@
#include "util/string.h"
INIT_LIST_HEAD(cookie_queries);
INIT_LIST_OF(struct cookie, cookie_queries);
static void
add_cookie_info_to_string(struct string *string, struct cookie *cookie,

View File

@ -6,7 +6,7 @@
#include "terminal/terminal.h"
#include "util/lists.h"
extern struct list_head cookie_queries;
extern LIST_OF(struct cookie) cookie_queries;
void accept_cookie_dialog(struct session *ses, void *data);
extern struct hierbox_browser cookie_browser;

View File

@ -812,7 +812,7 @@ enum frame_event_status
pass_uri_to_command(struct session *ses, struct document_view *doc_view,
int which_type)
{
struct list_head *tree = get_opt_tree("document.uri_passing");
LIST_OF(struct option) *tree = get_opt_tree("document.uri_passing");
enum pass_uri_type type = which_type;
struct menu_item *items;
struct option *option;
@ -887,7 +887,7 @@ void
add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type,
unsigned char *text)
{
struct list_head *tree = get_opt_tree("document.uri_passing");
LIST_OF(struct option) *tree = get_opt_tree("document.uri_passing");
struct option *option;
int commands = 0;
enum menu_item_flags flags = NO_FLAG;

View File

@ -117,7 +117,8 @@ static css_applier_T css_appliers[CSS_PT_LAST] = {
static void
examine_element(struct html_context *html_context, struct css_selector *base,
enum css_selector_type seltype, enum css_selector_relation rel,
struct list_head *selectors, struct html_element *element)
LIST_OF(struct css_selector) *selectors,
struct html_element *element)
{
struct css_selector *selector;
@ -141,7 +142,7 @@ examine_element(struct html_context *html_context, struct css_selector *base,
dbginfo(sel, type, base); \
merge_css_selectors(base, sel); \
/* Ancestor matches? */ \
if ((struct list_head *) element->next \
if ((LIST_OF(struct html_element) *) element->next \
!= &html_context->stack) { \
struct html_element *ancestor; \
/* This is less effective than doing reverse iterations,
@ -151,7 +152,7 @@ examine_element(struct html_context *html_context, struct css_selector *base,
* have to duplicate the whole examine_element(), so if
* profiles won't show it really costs... */ \
for (ancestor = element->next; \
(struct list_head *) ancestor \
(LIST_OF(struct html_element) *) ancestor \
!= &html_context->stack;\
ancestor = ancestor->next) \
examine_element(html_context, base, \
@ -220,7 +221,7 @@ struct css_selector *
get_css_selector_for_element(struct html_context *html_context,
struct html_element *element,
struct css_stylesheet *css,
struct list_head *html_stack)
LIST_OF(struct html_element) *html_stack)
{
unsigned char *code;
struct css_selector *selector;
@ -280,7 +281,7 @@ apply_css_selector_style(struct html_context *html_context,
void
css_apply(struct html_context *html_context, struct html_element *element,
struct css_stylesheet *css, struct list_head *html_stack)
struct css_stylesheet *css, LIST_OF(struct html_element) *html_stack)
{
struct css_selector *selector;

View File

@ -17,7 +17,7 @@ struct css_selector *
get_css_selector_for_element(struct html_context *html_context,
struct html_element *element,
struct css_stylesheet *css,
struct list_head *html_stack);
LIST_OF(struct html_element) *html_stack);
/* Apply properties from an existing selector. */
@ -30,6 +30,7 @@ apply_css_selector_style(struct html_context *html_context,
* attributes (if it contains such an attribute). */
void
css_apply(struct html_context *html_context, struct html_element *element,
struct css_stylesheet *css, struct list_head *html_stack);
struct css_stylesheet *css,
LIST_OF(struct html_element) *html_stack);
#endif

View File

@ -23,7 +23,8 @@
void
css_parse_properties(struct list_head *props, struct scanner *scanner)
css_parse_properties(LIST_OF(struct css_property) *props,
struct scanner *scanner)
{
assert(props && scanner);
@ -195,7 +196,8 @@ struct selector_pkg {
*
* @returns @a selector or the one into which it was merged. */
static struct css_selector *
reparent_selector(struct list_head *sels, struct css_selector *selector,
reparent_selector(LIST_OF(struct css_selector) *sels,
struct css_selector *selector,
struct css_selector **watch)
{
struct css_selector *twin = find_css_selector(sels, selector->type,
@ -230,7 +232,7 @@ reparent_selector(struct list_head *sels, struct css_selector *selector,
*/
static void
css_parse_selector(struct css_stylesheet *css, struct scanner *scanner,
struct list_head *selectors)
LIST_OF(struct selector_pkg) *selectors)
{
/* Shell for the last selector (the whole selector chain, that is). */
struct selector_pkg *pkg = NULL;
@ -470,8 +472,8 @@ css_parse_selector(struct css_stylesheet *css, struct scanner *scanner,
static void
css_parse_ruleset(struct css_stylesheet *css, struct scanner *scanner)
{
INIT_LIST_HEAD(selectors);
INIT_LIST_HEAD(properties);
INIT_LIST_OF(struct selector_pkg, selectors);
INIT_LIST_OF(struct css_property, properties);
struct selector_pkg *pkg;
css_parse_selector(css, scanner, &selectors);

View File

@ -15,7 +15,8 @@ struct uri;
* css_property}es to the specified list. The function returns positive value
* in case it recognized a property in the given string, or zero in case of an
* error. */
void css_parse_properties(struct list_head *props, struct scanner *scanner);
void css_parse_properties(LIST_OF(struct css_property) *props,
struct scanner *scanner);
/* Parses the @string and adds any recognized selectors + properties to the

View File

@ -25,7 +25,8 @@
struct css_selector *
find_css_selector(struct list_head *sels, enum css_selector_type type,
find_css_selector(LIST_OF(struct css_selector) *sels,
enum css_selector_type type,
enum css_selector_relation rel,
const unsigned char *name, int namelen)
{
@ -45,7 +46,8 @@ find_css_selector(struct list_head *sels, enum css_selector_type type,
}
struct css_selector *
init_css_selector(struct list_head *sels, enum css_selector_type type,
init_css_selector(LIST_OF(struct css_selector) *sels,
enum css_selector_type type,
unsigned char *name, int namelen)
{
struct css_selector *selector;
@ -78,7 +80,8 @@ init_css_selector(struct list_head *sels, enum css_selector_type type,
}
struct css_selector *
get_css_selector(struct list_head *sels, enum css_selector_type type,
get_css_selector(LIST_OF(struct css_selector) *sels,
enum css_selector_type type,
enum css_selector_relation rel,
unsigned char *name, int namelen)
{
@ -127,7 +130,7 @@ add_selector_property(struct css_selector *selector, struct css_property *prop)
void
add_selector_properties(struct css_selector *selector,
struct list_head *properties)
LIST_OF(struct css_property) *properties)
{
struct css_property *prop;
@ -185,7 +188,7 @@ done_css_selector(struct css_selector *selector)
#ifdef DEBUG_CSS
void
dump_css_selector_tree_iter(struct list_head *sels, int level)
dump_css_selector_tree_iter(LIST_OF(struct css_selector) *sels, int level)
{
struct css_selector *sel;
@ -204,7 +207,7 @@ dump_css_selector_tree_iter(struct list_head *sels, int level)
}
void
dump_css_selector_tree(struct list_head *sels)
dump_css_selector_tree(LIST_OF(struct css_selector) *sels)
{
dump_css_selector_tree_iter(sels, 0);
}

View File

@ -106,7 +106,7 @@ void done_css_stylesheet(struct css_stylesheet *css);
/* Returns a new freshly made selector adding it to the given selector
* list, or NULL. */
struct css_selector *get_css_selector(struct list_head *selector_list,
struct css_selector *get_css_selector(LIST_OF(struct css_selector) *selector_list,
enum css_selector_type type,
enum css_selector_relation rel,
unsigned char *name, int namelen);
@ -117,7 +117,7 @@ struct css_selector *get_css_selector(struct list_head *selector_list,
/* Looks up the selector of the name @name and length @namelen in the
* given list of selectors. */
struct css_selector *find_css_selector(struct list_head *selector_list,
struct css_selector *find_css_selector(LIST_OF(struct css_selector) *selector_list,
enum css_selector_type type,
enum css_selector_relation rel,
const unsigned char *name, int namelen);
@ -127,13 +127,13 @@ struct css_selector *find_css_selector(struct list_head *selector_list,
/* Initialize the selector structure. This is a rather low-level function from
* your POV. */
struct css_selector *init_css_selector(struct list_head *selector_list,
struct css_selector *init_css_selector(LIST_OF(struct css_selector) *selector_list,
enum css_selector_type type,
unsigned char *name, int namelen);
/* Add all properties from the list to the given @selector. */
void add_selector_properties(struct css_selector *selector,
struct list_head *properties);
LIST_OF(struct css_property) *properties);
/* Join @sel2 to @sel1, @sel1 taking precedence in all conflicts. */
void merge_css_selectors(struct css_selector *sel1, struct css_selector *sel2);
@ -143,7 +143,7 @@ void done_css_selector(struct css_selector *selector);
#ifdef DEBUG_CSS
/* Dumps the selector tree to stderr. */
void dump_css_selector_tree(struct list_head *selector_list);
void dump_css_selector_tree(LIST_OF(struct css_selector) *selector_list);
#endif
#endif

View File

@ -33,7 +33,7 @@
#include "viewer/text/link.h"
static INIT_LIST_HEAD(format_cache);
static INIT_LIST_OF(struct document, format_cache);
struct document *
init_document(struct cache_entry *cached, struct document_options *options)

View File

@ -59,7 +59,7 @@ struct html_context {
* html/parser/parse.c
* html/parser/stack.c
* html/parser.c */
struct list_head stack;
LIST_OF(struct html_element) stack;
/* For parser/parse.c: */
unsigned char *eoff; /* For parser/forms.c too */

View File

@ -1863,7 +1863,7 @@ void
check_html_form_hierarchy(struct part *part)
{
struct document *document = part->document;
INIT_LIST_HEAD(form_controls);
INIT_LIST_OF(struct form_control, form_controls);
struct form *form;
struct form_control *fc, *next;

View File

@ -51,7 +51,8 @@
* But I want to take no risk by reworking that now. --pasky */
static void
add_snippets(struct ecmascript_interpreter *interpreter,
struct list_head *doc_snippets, struct list_head *queued_snippets)
LIST_OF(struct string_list_item) *doc_snippets,
LIST_OF(struct string_list_item) *queued_snippets)
{
struct string_list_item *doc_current = doc_snippets->next;
@ -110,7 +111,8 @@ add_snippets(struct ecmascript_interpreter *interpreter,
static void
process_snippets(struct ecmascript_interpreter *interpreter,
struct list_head *snippets, struct string_list_item **current)
LIST_OF(struct string_list_item) *snippets,
struct string_list_item **current)
{
if (!*current)
*current = snippets->next;

View File

@ -42,7 +42,7 @@ static struct option_info forms_history_options[] = {
NULL_OPTION_INFO,
};
INIT_LIST_HEAD(saved_forms);
INIT_LIST_OF(struct formhist_data, saved_forms);
static struct formhist_data *
new_formhist_item(unsigned char *url)
@ -386,7 +386,7 @@ get_form_history_value(unsigned char *url, unsigned char *name)
}
void
memorize_form(struct session *ses, struct list_head *submit,
memorize_form(struct session *ses, LIST_OF(struct submitted_value) *submit,
struct form *forminfo)
{
/* [gettext_accelerator_context(memorize_form)] */

View File

@ -11,7 +11,7 @@ struct formhist_data {
OBJECT_HEAD(struct formhist_data);
/* List of submitted_values for this form */
struct list_head *submit;
LIST_OF(struct submitted_value) *submit;
struct listbox_item *box_item;
@ -26,7 +26,9 @@ struct formhist_data {
* value if present, NULL upon an error. */
unsigned char *get_form_history_value(unsigned char *url, unsigned char *name);
void memorize_form(struct session *ses, struct list_head *submit, struct form *forminfo);
void memorize_form(struct session *ses,
LIST_OF(struct submitted_value) *submit,
struct form *forminfo);
int save_formhist_to_file(void);
void delete_formhist_item(struct formhist_data *form);

View File

@ -39,7 +39,7 @@
INIT_INPUT_HISTORY(global_history);
INIT_LIST_HEAD(global_history_reap_list);
INIT_LIST_OF(struct global_history_item, global_history_reap_list);
/* GUI stuff. Declared here because done_global_history() frees it. */

View File

@ -62,7 +62,7 @@ static int init_b = 0;
/* Check if either stdin or stdout are pipes */
static void
check_stdio(struct list_head *url_list)
check_stdio(LIST_OF(struct string_list_item) *url_list)
{
assert(!remote_session_flags);
@ -105,7 +105,7 @@ check_cwd(void)
static void
init(void)
{
INIT_LIST_HEAD(url_list);
INIT_LIST_OF(struct string_list_item, url_list);
int fd = -1;
enum retval ret;

View File

@ -82,7 +82,7 @@ struct bottom_half {
void *data;
};
static INIT_LIST_HEAD(bottom_halves);
static INIT_LIST_OF(struct bottom_half, bottom_halves);
int
register_bottom_half_do(select_handler_T fn, void *data)

View File

@ -24,7 +24,7 @@ struct timer {
/* @timers.next points to the timer with the smallest interval,
* @timers.next->next to the second smallest, and so on. */
static INIT_LIST_HEAD(timers);
static INIT_LIST_OF(struct timer, timers);
int
get_timers_count(void)

View File

@ -146,7 +146,7 @@ void
menu_list_ext(struct terminal *term, void *fn_, void *xxx)
{
menu_func_T fn = fn_;
struct list_head *opt_tree = get_opt_tree("mime.extension");
LIST_OF(struct option) *opt_tree = get_opt_tree("mime.extension");
struct option *opt;
struct menu_item *mi = NULL;

View File

@ -59,9 +59,9 @@ static unsigned int connection_id = 0;
static int active_connections = 0;
static timer_id_T keepalive_timeout = TIMER_ID_UNDEF;
static INIT_LIST_HEAD(connection_queue);
static INIT_LIST_HEAD(host_connections);
static INIT_LIST_HEAD(keepalive_connections);
static INIT_LIST_OF(struct connection, connection_queue);
static INIT_LIST_OF(struct host_connection, host_connections);
static INIT_LIST_OF(struct keepalive_connection, keepalive_connections);
/* Prototypes */
static void notify_connection_callbacks(struct connection *conn);

View File

@ -16,7 +16,7 @@ struct uri;
struct connection {
LIST_HEAD(struct connection);
struct list_head downloads;
LIST_OF(struct download) downloads;
struct progress *progress;
/* If no proxy is used uri and proxied_uri are the same. */
@ -82,7 +82,7 @@ struct popen_data {
unsigned char *filename;
};
extern struct list_head copiousoutput_data;
extern LIST_OF(struct popen_data) copiousoutput_data;
int register_check_queue(void);

View File

@ -76,7 +76,7 @@ struct dnsquery {
static struct dnsquery *dns_queue = NULL;
#endif
static INIT_LIST_HEAD(dns_cache);
static INIT_LIST_OF(struct dnsentry, dns_cache);
static void done_dns_lookup(struct dnsquery *query, enum dns_result res);

View File

@ -136,7 +136,7 @@ struct strerror_val {
unsigned char msg[1]; /* must be last */
};
static INIT_LIST_HEAD(strerror_buf); /* struct strerror_val */
static INIT_LIST_OF(struct strerror_val, strerror_buf);
/* It returns convenient error message, depending on @state.
* It never returns NULL (if one changes that, be warn that

View File

@ -61,7 +61,7 @@ struct active_thread {
void *data;
};
INIT_LIST_HEAD(active_threads);
INIT_LIST_OF(struct active_thread, active_threads);
int32
started_thr(void *data)
@ -114,12 +114,14 @@ rel:
void
terminate_osdep(void)
{
struct list_head *p;
LIST_OF(struct active_thread) *p;
struct active_thread *thrd;
if (acquire_sem(thr_sem) < B_NO_ERROR) return;
foreach (thrd, active_threads) kill_thread(thrd->tid);
/* Cannot use free_list(active_threads) because it would call
* mem_free(p) and we need free(p). */
while ((p = active_threads.next) != &active_threads) {
del_from_list(p);
free(p);

View File

@ -26,7 +26,7 @@
#define DEBUG_HTTP_AUTH
#endif
static INIT_LIST_HEAD(auth_entry_list);
static INIT_LIST_OF(struct auth_entry, auth_entry_list);
/* Find if url/realm is in auth list. If a matching url is found, but realm is

View File

@ -228,7 +228,7 @@ get_bittorrent_peerwire_max_request_length(void)
/* File selection store. */
static INIT_LIST_HEAD(bittorrent_selections);
static INIT_LIST_OF(struct bittorrent_selection_info, bittorrent_selections);
struct bittorrent_selection_info {
LIST_HEAD(struct bittorrent_selection_info);
@ -291,7 +291,7 @@ add_bittorrent_selection(struct uri *uri, int *selection, size_t size)
/* Message queue. */
static INIT_LIST_HEAD(bittorrent_messages);
static INIT_LIST_OF(struct bittorrent_message, bittorrent_messages);
void
add_bittorrent_message(struct uri *uri, enum connection_state state,

View File

@ -463,7 +463,7 @@ struct bittorrent_blacklist_item {
bittorrent_id_T id;
};
static INIT_LIST_HEAD(bittorrent_blacklist);
static INIT_LIST_OF(struct bittorrent_blacklist_item, bittorrent_blacklist);
static struct bittorrent_blacklist_item *

View File

@ -43,12 +43,12 @@
static int bittorrent_socket = -1;
/* The active BitTorrent connections sharing the above listening port. */
static INIT_LIST_HEAD(bittorrent_connections);
static INIT_LIST_OF(struct bittorrent_connection, bittorrent_connections);
/* The incoming (and pending anonymous) peer connections which has not yet been
* assigned to a BitTorrent connection because the info hash has not been read
* from the handshake. */
static INIT_LIST_HEAD(bittorrent_peer_connections);
static INIT_LIST_OF(struct bittorrent_peer_connection, bittorrent_peer_connections);
/* Loop the bittorrent connection list and return matching connection

View File

@ -341,7 +341,7 @@ add_piece_to_bittorrent_free_list(struct bittorrent_piece_cache *cache,
{
struct bittorrent_peer_request *request, *next;
uint32_t request_length, piece_length, piece_offset;
INIT_LIST_HEAD(requests);
INIT_LIST_OF(struct bittorrent_peer_request, requests);
uint16_t blocks = 0;
assert(piece <= bittorrent->meta.pieces);

View File

@ -22,7 +22,7 @@ struct blacklist_entry {
unsigned char host[1]; /* Must be last. */
};
static INIT_LIST_HEAD(blacklist);
static INIT_LIST_OF(struct blacklist_entry, blacklist);
static struct blacklist_entry *

View File

@ -44,7 +44,7 @@ struct negotiate {
gss_buffer_desc input_token;
};
static INIT_LIST_HEAD(negotiate_list);
static INIT_LIST_OF(struct negotiate, negotiate_list);
static struct negotiate *
http_negotiate_get(struct uri *uri, int *isnew, int alloc)

View File

@ -62,9 +62,9 @@
/* TODO: tp_*() should be in separate file, I guess? --pasky */
INIT_LIST_HEAD(downloads);
INIT_LIST_OF(struct file_download, downloads);
INIT_LIST_HEAD(copiousoutput_data);
INIT_LIST_OF(struct popen_data, copiousoutput_data);
int
download_is_progressing(struct download *download)

View File

@ -85,7 +85,7 @@ struct file_download {
};
/* Stack of all running downloads */
extern struct list_head downloads;
extern LIST_OF(struct file_download) downloads;
static inline int
is_in_downloads_list(struct file_download *file_download)

View File

@ -24,7 +24,7 @@
static inline void
free_history(struct list_head *history)
free_history(LIST_OF(struct location) *history)
{
while (!list_empty(*history)) {
struct location *loc = history->next;

View File

@ -8,7 +8,7 @@
struct location {
LIST_HEAD(struct location);
struct list_head frames;
LIST_OF(struct frame) frames;
struct download download;
struct view_state vs;
};

View File

@ -84,7 +84,7 @@ struct session_info {
#define file_to_load_is_active(ftl) ((ftl)->req_sent && is_in_progress_state((ftl)->download.state))
INIT_LIST_HEAD(sessions);
INIT_LIST_OF(struct session, sessions);
enum remote_session_flags remote_session_flags;
@ -96,7 +96,7 @@ static struct file_to_load *request_additional_file(struct session *,
static window_handler_T tabwin_func;
static INIT_LIST_HEAD(session_info);
static INIT_LIST_OF(struct session_info, session_info);
static int session_info_id = 1;
static struct session_info *
@ -474,7 +474,7 @@ struct questions_entry {
void *data;
};
INIT_LIST_HEAD(questions_queue);
INIT_LIST_OF(struct questions_entry, questions_queue);
void
@ -975,7 +975,8 @@ init_remote_session(struct session *ses, enum remote_session_flags *remote_ptr,
struct string *
encode_session_info(struct string *info, struct list_head *url_list)
encode_session_info(struct string *info,
LIST_OF(struct string_list_item) *url_list)
{
struct string_list_item *url;

View File

@ -221,7 +221,8 @@ print_error_dialog(struct session *ses, enum connection_state state,
void process_file_requests(struct session *);
struct string *encode_session_info(struct string *info, struct list_head *url_list);
struct string *encode_session_info(struct string *info,
LIST_OF(struct string_list_item) *url_list);
/* Returns zero if the info was remote sessions or if it failed to create any
* sessions. */
@ -262,7 +263,7 @@ struct link *get_current_link_in_view(struct document_view *doc_view);
unsigned char *get_current_link_url(struct session *, unsigned char *, size_t);
unsigned char *get_current_link_name(struct session *, unsigned char *, size_t);
extern struct list_head questions_queue;
extern LIST_OF(struct questions_entry) questions_queue;
void add_questions_entry(void (*callback)(struct session *, void *), void *data);
void check_questions_queue(struct session *ses);

View File

@ -269,7 +269,7 @@ static const struct screen_driver_opt *const screen_driver_opts[] = {
#define use_utf8_io(driver) ((driver)->opt.charsets[0] != -1)
static INIT_LIST_HEAD(active_screen_drivers);
static INIT_LIST_OF(struct screen_driver, active_screen_drivers);
/* Set driver->opt according to driver->type and term_spec.
* Other members of *driver need not have been initialized.

View File

@ -106,7 +106,7 @@ get_tab_by_number(struct terminal *term, int num)
/* Ensure that the return value actually points to a struct
* window. */
assertm((struct list_head *) win != &term->windows,
assertm((LIST_OF(struct window) *) win != &term->windows,
"tab number out of range");
if_assert_failed return term->windows.next;

View File

@ -36,7 +36,7 @@
#include "viewer/text/textarea.h"
INIT_LIST_HEAD(terminals);
INIT_LIST_OF(struct terminal, terminals);
static void check_if_no_terminal(void);

View File

@ -115,10 +115,14 @@ struct xlist_head {
#endif /* LISTDEBUG */
#define INIT_LIST_HEAD(x) struct list_head x = { D_LIST_HEAD(x) }
/** Define and initialize a list variable. The @a element_T parameter
* currently serves as documentation only; the compiler does not check
* that it matches. */
#define INIT_LIST_OF(element_T, x) struct list_head x = { D_LIST_HEAD(x) }
/** A list intended to contain elements of a specific type. The
* parameter currently serves as documentation only. Doxyfile defines
* @a element_T parameter currently serves as documentation only;
* the compiler does not check that it matches. Doxyfile defines
* this macro differently in order to get better collaboration
* diagrams. */
#define LIST_OF(element_T) struct list_head

View File

@ -163,7 +163,7 @@ struct alloc_header {
struct mem_stats mem_stats;
INIT_LIST_HEAD(memory_list);
INIT_LIST_OF(struct alloc_header, memory_list);
#ifdef LOG_MEMORY_ALLOC
static void

View File

@ -467,8 +467,8 @@ add_format_to_string(struct string *string, const unsigned char *format, ...)
}
struct string *
add_to_string_list(struct list_head *list, const unsigned char *source,
int length)
add_to_string_list(LIST_OF(struct string_list_item) *list,
const unsigned char *source, int length)
{
struct string_list_item *item;
struct string *string;
@ -494,7 +494,7 @@ add_to_string_list(struct list_head *list, const unsigned char *source,
}
void
free_string_list(struct list_head *list)
free_string_list(LIST_OF(struct string_list_item) *list)
{
assertm(list != NULL, "[free_string_list]");
if_assert_failed return;

View File

@ -250,10 +250,10 @@ struct string_list_item {
/* Adds @string with @length chars to the list. If length is -1 it will be set
* to the return value of strlen(). */
struct string *
add_to_string_list(struct list_head *list, const unsigned char *string,
int length);
add_to_string_list(LIST_OF(struct string_list_item) *list,
const unsigned char *string, int length);
void free_string_list(struct list_head *list);
void free_string_list(LIST_OF(struct string_list_item) *list);
/* Returns an empty C string or @str if different from NULL. */

View File

@ -301,10 +301,10 @@ terminate:
}
void
dump_next(struct list_head *url_list)
dump_next(LIST_OF(struct string_list_item) *url_list)
{
static INIT_LIST_HEAD(todo_list);
static INIT_LIST_HEAD(done_list);
static INIT_LIST_OF(struct string_list_item, todo_list);
static INIT_LIST_OF(struct string_list_item, done_list);
struct string_list_item *item;
if (url_list) {

View File

@ -12,6 +12,6 @@ struct string *
add_document_to_string(struct string *string, struct document *document);
int dump_to_file(struct document *, int);
void dump_next(struct list_head *);
void dump_next(LIST_OF(struct string_list_item) *);
#endif

View File

@ -611,7 +611,7 @@ draw_forms(struct terminal *term, struct document_view *doc_view)
void
done_submitted_value_list(struct list_head *list)
done_submitted_value_list(LIST_OF(struct submitted_value) *list)
{
struct submitted_value *sv, *svtmp;
@ -629,7 +629,7 @@ done_submitted_value_list(struct list_head *list)
static void
add_submitted_value_to_list(struct form_control *fc,
struct form_state *fs,
struct list_head *list)
LIST_OF(struct submitted_value) *list)
{
struct submitted_value *sub;
unsigned char *name;
@ -691,7 +691,7 @@ add_submitted_value_to_list(struct form_control *fc,
}
static void
sort_submitted_values(struct list_head *list)
sort_submitted_values(LIST_OF(struct submitted_value) *list)
{
while (1) {
struct submitted_value *sub;
@ -723,7 +723,8 @@ sort_submitted_values(struct list_head *list)
static void
get_successful_controls(struct document_view *doc_view,
struct form_control *fc, struct list_head *list)
struct form_control *fc,
LIST_OF(struct submitted_value) *list)
{
struct form_control *fc2;
@ -748,7 +749,7 @@ get_successful_controls(struct document_view *doc_view,
}
static void
encode_controls(struct list_head *l, struct string *data,
encode_controls(LIST_OF(struct submitted_value) *l, struct string *data,
int cp_from, int cp_to)
{
struct submitted_value *sv;
@ -897,7 +898,8 @@ check_boundary(struct string *data, struct boundary_info *boundary)
/* FIXME: shouldn't we encode data at send time (in http.c) ? --Zas */
static void
encode_multipart(struct session *ses, struct list_head *l, struct string *data,
encode_multipart(struct session *ses, LIST_OF(struct submitted_value) *l,
struct string *data,
struct boundary_info *boundary, int cp_from, int cp_to)
{
struct conv_table *convert_table = NULL;
@ -1060,7 +1062,7 @@ encode_newlines(struct string *string, unsigned char *data)
}
static void
encode_text_plain(struct list_head *l, struct string *data,
encode_text_plain(LIST_OF(struct submitted_value) *l, struct string *data,
int cp_from, int cp_to)
{
struct submitted_value *sv;
@ -1140,7 +1142,7 @@ get_form_uri(struct session *ses, struct document_view *doc_view,
struct form_control *fc)
{
struct boundary_info boundary;
INIT_LIST_HEAD(submit);
INIT_LIST_OF(struct submitted_value, submit);
struct string data;
struct string go;
int cp_from, cp_to;

View File

@ -91,7 +91,7 @@ struct submitted_value {
struct submitted_value *init_submitted_value(unsigned char *name, unsigned char *value, enum form_type type, struct form_control *fc, int position);
void done_submitted_value(struct submitted_value *sv);
void done_submitted_value_list(struct list_head *list);
void done_submitted_value_list(LIST_OF(struct submitted_value) *list);
struct uri *get_form_uri(struct session *ses, struct document_view *doc_view, struct form_control *fc);