links

lynx-like text mode web browser
git clone anongit@rnpnr.xyz:links.git
Log | Files | Refs | Feed | README | LICENSE

Commit: 8051d2091969378a61ac3ea220ad2db7400f3de2
Parent: 4203b227de3b824b522541c90d8236d794ea2f65
Author: opask
Date:   Mon, 29 Oct 2018 11:31:59 -0600

silence many warnings by initializing pointers to NULL

Diffstat:
Mauth.c | 8++++----
Mbfu.c | 14+++++++-------
Mbookmark.c | 4++--
Mcache.c | 14+++++++-------
Mcompress.c | 2+-
Mcookies.c | 10+++++-----
Mdefault.c | 14+++++++-------
Mdns.c | 4++--
Mdrivers.c | 5++++-
Mhtml.c | 2+-
Mhtml_gr.c | 2+-
Mhtml_r.c | 12++++++------
Mhtml_tbl.c | 2+-
Mhttp.c | 2+-
Mhttps.c | 4++--
Mimg.c | 2+-
Mimgcache.c | 6+++---
Mkbd.c | 2+-
Mlinks.h | 11+++++++----
Mmain.c | 4++--
Mmemory.c | 4++--
Mmenu.c | 8++++----
Mobjreq.c | 4++--
Mos_dep.c | 8++++----
Msched.c | 36++++++++++++++++++------------------
Mselect.c | 10+++++-----
Msession.c | 64++++++++++++++++++++++++++++++++--------------------------------
Mterminal.c | 35++++++++++++++++++-----------------
Mtypes.c | 18+++++++++---------
Mview.c | 39+++++++++++++++++++++++----------------
30 files changed, 182 insertions(+), 168 deletions(-)

diff --git a/auth.c b/auth.c @@ -20,7 +20,7 @@ static const unsigned char base64_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi static unsigned char *base64_encode(unsigned char *in, size_t inlen) { unsigned char *out, *outstr; - int data_len; + size_t data_len; int line_mask = ~0; int col; if (inlen > INT_MAX / 2) overalloc(); @@ -135,7 +135,7 @@ static unsigned char *auth_from_url(unsigned char *url, int proxy) unsigned char *get_auth_string(unsigned char *url, int proxy) { - struct http_auth *a; + struct http_auth *a = NULL; struct list_head *la; unsigned char *host; int port; @@ -191,7 +191,7 @@ void free_auth(void) void add_auth(unsigned char *url, unsigned char *realm, unsigned char *user, unsigned char *password, int proxy) { - struct http_auth *a; + struct http_auth *a = NULL; struct list_head *la; unsigned char *host = NULL; int port = 0 /* against warning */; @@ -231,7 +231,7 @@ void add_auth(unsigned char *url, unsigned char *realm, unsigned char *user, uns int find_auth(unsigned char *url, unsigned char *realm) { - struct http_auth *a; + struct http_auth *a = NULL; struct list_head *la; unsigned char *data, *d; unsigned char *host = get_host_name(url); diff --git a/bfu.c b/bfu.c @@ -236,7 +236,7 @@ static void select_menu(struct terminal *term, struct menu *menu) return; flush_terminal(term); if (!it->in_m) { - struct window *win; + struct window *win = NULL; struct list_head *lwin; foreach(struct window, win, lwin, term->windows) { if (win->handler != menu_func && win->handler != mainmenu_func) @@ -504,7 +504,7 @@ static void menu_func(struct window *win, struct links_event *ev, int fwd) } if (ev->x < menu->x || ev->x >= menu->x+menu->xw || ev->y < menu->y || ev->y >= menu->y+menu->yw) { int f = 1; - struct window *w1; + struct window *w1 = NULL; struct list_head *w1l; foreachfrom(struct window, w1, w1l, win->term->windows, &win->list_entry) { struct menu *m1; @@ -733,7 +733,7 @@ static void select_mainmenu(struct terminal *term, struct mainmenu *menu) it = &menu->items[menu->selected]; if (it->hotkey == M_BAR) return; if (!it->in_m) { - struct window *win; + struct window *win = NULL; struct list_head *lwin; foreach(struct window, win, lwin, term->windows) { if (win->handler != menu_func && win->handler != mainmenu_func) @@ -1240,7 +1240,7 @@ static void do_tab_compl(struct terminal *term, struct list_head *history, struc { unsigned char *cdata = ((struct dialog_data*)win->data)->items[((struct dialog_data*)win->data)->selected].cdata; int l = (int)strlen(cast_const_char cdata), n = 0; - struct history_item *hi; + struct history_item *hi = NULL; struct list_head *lhi; struct menu_item *items = NULL; foreach(struct history_item, hi, lhi, *history) { @@ -1310,7 +1310,7 @@ void dialog_func(struct window *win, struct links_event *ev, int fwd) di->cur_hist = &di->history; if (di->item->type == D_FIELD || di->item->type == D_FIELD_PASS) { if (di->item->history) { - struct history_item *j; + struct history_item *j = NULL; struct list_head *lj; foreach(struct history_item, j, lj, di->item->history->items) { struct history_item *hi; @@ -2285,7 +2285,7 @@ void msg_box(struct terminal *term, struct memory_list *ml, unsigned char *title void add_to_history(struct terminal *term, struct history *h, unsigned char *t) { unsigned char *s; - struct history_item *hi, *hs; + struct history_item *hi, *hs = NULL; struct list_head *lhs; size_t l; if (!h || !t || !*t) return; @@ -2421,7 +2421,7 @@ void input_field(struct terminal *term, struct memory_list *ml, unsigned char *t int find_msg_box(struct terminal *term, unsigned char *title, int (*sel)(void *, void *), void *data) { - struct window *win; + struct window *win = NULL; struct list_head *lwin; foreach(struct window, win, lwin, term->windows) if (win->handler == dialog_func) { struct dialog_data *dd = win->data; diff --git a/bookmark.c b/bookmark.c @@ -77,7 +77,7 @@ struct kawasaki { /* clears the bookmark list */ static void free_bookmarks(void) { - struct list *b; + struct list *b = NULL; struct list_head *lb; foreach(struct list, b, lb, bookmarks.list_entry) { @@ -704,7 +704,7 @@ static unsigned char *convert_to_entity_string(unsigned char *str) /* writes bookmarks to disk */ static void save_bookmarks(struct session *ses) { - struct list *li; + struct list *li = NULL; struct list_head *lli; int depth; int a; diff --git a/cache.c b/cache.c @@ -58,7 +58,7 @@ static struct cache_entry *cache_search_tree(unsigned char *url) int cache_info(int type) { int i = 0; - struct cache_entry *ce; + struct cache_entry *ce = NULL; struct list_head *lce; switch (type) { case CI_BYTES: @@ -82,7 +82,7 @@ int cache_info(int type) int decompress_info(int type) { int i = 0; - struct cache_entry *ce; + struct cache_entry *ce = NULL; struct list_head *lce; switch (type) { case CI_BYTES: @@ -198,7 +198,7 @@ int page_size = 4096; int add_fragment(struct cache_entry *e, off_t offset, const unsigned char *data, off_t length) { - struct fragment *f; + struct fragment *f = NULL; struct list_head *lf; struct fragment *nf; int trunc = 0; @@ -355,7 +355,7 @@ int defrag_entry(struct cache_entry *e) void truncate_entry(struct cache_entry *e, off_t off, int final) { int modified = final == 2; - struct fragment *f, *g; + struct fragment *f = NULL, *g; struct list_head *lf; if (e->length > off) { e->length = off; @@ -395,7 +395,7 @@ void truncate_entry(struct cache_entry *e, off_t off, int final) void free_entry_to(struct cache_entry *e, off_t off) { - struct fragment *f; + struct fragment *f = NULL; struct list_head *lf; e->incomplete = 1; free_decompressed_data(e); @@ -424,7 +424,7 @@ void delete_entry_content(struct cache_entry *e) void trim_cache_entry(struct cache_entry *e) { - struct fragment *f, *nf; + struct fragment *f = NULL, *nf; struct list_head *lf; foreach(struct fragment, f, lf, e->frag) { if (f->length != f->real_length) { @@ -457,7 +457,7 @@ void delete_cache_entry(struct cache_entry *e) static int shrink_file_cache(int u) { int r = 0; - struct cache_entry *e, *f; + struct cache_entry *e = NULL, *f = NULL; struct list_head *le, *lf; int ncs = cache_size; int ccs = 0, ccs2 = 0; diff --git a/compress.c b/compress.c @@ -64,7 +64,7 @@ static int decode_gzip(struct terminal *term, struct cache_entry *ce, int defl, off_t offset; int r; unsigned char *p; - struct fragment *f; + struct fragment *f = NULL; struct list_head *lf; size_t size; diff --git a/cookies.c b/cookies.c @@ -48,7 +48,7 @@ int set_cookie(struct terminal *term, unsigned char *url, unsigned char *str) return 0; int noval = 0; struct cookie *cookie; - struct c_server *cs; + struct c_server *cs = NULL; struct list_head *lcs; unsigned char *p, *q, *s, *server, *date, *dom; for (p = str; *p != ';' && *p; p++); @@ -121,9 +121,9 @@ ok: static void accept_cookie(struct cookie *c) { - struct c_domain *cd; + struct c_domain *cd = NULL; struct list_head *lcd; - struct cookie *d; + struct cookie *d = NULL; struct list_head *ld; size_t sl; foreach(struct cookie, d, ld, all_cookies) @@ -186,9 +186,9 @@ int cookie_expired(struct cookie *c) /* parse_http_date is broken */ void add_cookies(unsigned char **s, int *l, unsigned char *url) { int nc = 0; - struct c_domain *cd; + struct c_domain *cd = NULL; struct list_head *lcd; - struct cookie *c; + struct cookie *c = NULL; struct list_head *lc; unsigned char *server = get_host_name(url); unsigned char *data = get_url_data(url); diff --git a/default.c b/default.c @@ -596,7 +596,7 @@ static unsigned char *type_rd(struct option *o, unsigned char *c) static void type_wr(struct option *o, unsigned char **s, int *l) { - struct list *a; + struct list *a = NULL; struct list_head *la; foreachback(struct list, a, la, assoc.list_entry) { struct assoc *as = get_struct(a, struct assoc, head); @@ -630,7 +630,7 @@ static unsigned char *ext_rd(struct option *o, unsigned char *c) static void ext_wr(struct option *o, unsigned char **s, int *l) { - struct list *a; + struct list *a = NULL; struct list_head *la; foreachback(struct list, a, la, extensions.list_entry) { struct extension *e = get_struct(a, struct extension, head); @@ -723,7 +723,7 @@ static unsigned char *term2_rd(struct option *o, unsigned char *c) static void term_wr(struct option *o, unsigned char **s, int *l) { - struct term_spec *ts; + struct term_spec *ts = NULL; struct list_head *lts; foreachback(struct term_spec, ts, lts, term_specs) { add_nm(o, s, l); @@ -754,7 +754,7 @@ static struct list_head driver_params = { &driver_params, &driver_params }; struct driver_param *get_driver_param(unsigned char *n) { - struct driver_param *dp; + struct driver_param *dp = NULL; size_t sl; struct list_head *ldp; foreach(struct driver_param, dp, ldp, driver_params) if (!casestrcmp(dp->name, n)) return dp; @@ -804,7 +804,7 @@ static unsigned char *dp_rd(struct option *o, unsigned char *c) static void dp_wr(struct option *o, unsigned char **s, int *l) { - struct driver_param *dp; + struct driver_param *dp = NULL; struct list_head *ldp; foreachback(struct driver_param, dp, ldp, driver_params) { if ((!dp->param || !*dp->param) && !*dp->shell_term && dp->kbd_codepage < 0 && !dp->palette_mode) @@ -956,7 +956,7 @@ static unsigned char *printhelp_cmd(struct option *o, unsigned char ***argv, int void end_config(void) { - struct driver_param *dp; + struct driver_param *dp = NULL; struct list_head *ldp; foreach(struct driver_param, dp, ldp, driver_params) { free(dp->param); @@ -1254,7 +1254,7 @@ void load_url_history(void) void save_url_history(void) { - struct history_item *hi; + struct history_item *hi = NULL; struct list_head *lhi; unsigned char *history_file; unsigned char *hs; diff --git a/dns.c b/dns.c @@ -288,7 +288,7 @@ static void check_dns_cache_addr_preference(void) static int find_in_dns_cache(unsigned char *name, struct dnsentry **dnsentry) { - struct dnsentry *e; + struct dnsentry *e = NULL; struct list_head *le; check_dns_cache_addr_preference(); foreach(struct dnsentry, e, le, dns_cache) @@ -434,7 +434,7 @@ unsigned long dns_info(int type) static int shrink_dns_cache(int u) { uttime now = get_absolute_time(); - struct dnsentry *d; + struct dnsentry *d = NULL; struct list_head *ld; int f = 0; if (u == SH_FREE_SOMETHING && !list_empty(dns_cache)) { diff --git a/drivers.c b/drivers.c @@ -216,7 +216,10 @@ void set_clip_area(struct graphics_device *dev, struct rect *r) int restrict_clip_area(struct graphics_device *dev, struct rect *r, int x1, int y1, int x2, int y2) { struct rect v, rr; - rr.x1 = x1, rr.x2 = x2, rr.y1 = y1, rr.y2 = y2; + rr.x1 = x1; + rr.x2 = x2; + rr.y1 = y1; + rr.y2 = y2; if (r) memcpy(r, &dev->clip, sizeof(struct rect)); intersect_rect(&v, &dev->clip, &rr); set_clip_area(dev, &v); diff --git a/html.c b/html.c @@ -3161,7 +3161,7 @@ do { \ } } } else { - struct html_element *e, *fx; + struct html_element *e = NULL, *fx = NULL; struct list_head *le, *lfx; int lnb = 0; int xxx = 0; diff --git a/html_gr.c b/html_gr.c @@ -968,7 +968,7 @@ struct g_part *g_format_html_part(unsigned char *start, unsigned char *end, int int wa; struct g_part *p; struct html_element *e; - struct form_control *fc; + struct form_control *fc = NULL; struct list_head *lfc; int lm = margin; diff --git a/html_r.c b/html_r.c @@ -76,7 +76,7 @@ struct frameset_desc *copy_frameset_desc(struct frameset_desc *fd) void free_additional_files(struct additional_files **a) { - struct additional_file *af; + struct additional_file *af = NULL; struct list_head *laf; if (!*a) return; if (--(*a)->refcount) { @@ -93,7 +93,7 @@ static void clear_formatted(struct f_data *scr) { int n; int y; - struct form_control *fc; + struct form_control *fc = NULL; struct list_head *lfc; if (!scr) return; @@ -404,7 +404,7 @@ static struct list_head *last_tag_for_newline; static inline void move_links(struct part *p, int xf, int yf, int xt, int yt) { int n; - struct tag *t; + struct tag *t = NULL; struct list_head *lt; int w = 0; if (!p->data) return; @@ -811,7 +811,7 @@ static void put_chars(void *p_, unsigned char *c, int l) static void line_break(void *p_) { struct part *p = p_; - struct tag *t; + struct tag *t = NULL; struct list_head *lt; if (p->cx >= 0 && safe_add(p->cx, par_format.rightmargin) > p->x) p->x = p->cx + par_format.rightmargin; if (nobreak) { @@ -1014,7 +1014,7 @@ struct part *format_html_part(unsigned char *start, unsigned char *end, int alig struct list_head *ltm = last_tag_to_move; int lm = margin; int ef = empty_format; - struct form_control *fc; + struct form_control *fc = NULL; struct list_head *lfc; if (par_format.implicit_pre_wrap) { @@ -1446,7 +1446,7 @@ static int add_srch_chr(struct f_data *f, unsigned c, int x, int y, int nn) static int get_srch(struct f_data *f) { - struct node *n; + struct node *n = NULL; struct list_head *ln; get_srch_reset(); #define add_srch(c_, x_, y_, n_) \ diff --git a/html_tbl.c b/html_tbl.c @@ -2075,7 +2075,7 @@ void add_table_cache_entry(unsigned char *start, unsigned char *end, int align, static void free_table_cache(void) { - struct table_cache_entry *tce; + struct table_cache_entry *tce = NULL; struct list_head *ltce; foreach(struct table_cache_entry, tce, ltce, table_cache) { int hash = make_hash(tce->start, tce->xs); diff --git a/http.c b/http.c @@ -720,7 +720,7 @@ next_chunk: } else if (info->chunk_remaining == -1) { int l; if ((l = is_line_in_buffer(rb))) { - unsigned char *de; + unsigned char *de = NULL; long n = 0; if (l != -1) n = strtol((char *)rb->data, (char **)(void *)&de, 16); diff --git a/https.c b/https.c @@ -187,7 +187,7 @@ unsigned char *get_cipher_string(links_ssl *ssl) static struct session_cache_entry *find_session_cache_entry(SSL_CTX *ctx, char *host, int port) { - struct session_cache_entry *sce; + struct session_cache_entry *sce = NULL; struct list_head *lsce; foreach(struct session_cache_entry, sce, lsce, session_cache) if (sce->ctx == ctx && !strcmp(&sce->host, host)) @@ -257,7 +257,7 @@ void retrieve_ssl_session(struct connection *c) static int shrink_session_cache(int u) { uttime now = get_absolute_time(); - struct session_cache_entry *d; + struct session_cache_entry *d = NULL; struct list_head *ld; int f = 0; if (u == SH_FREE_SOMETHING && !list_empty(session_cache)) { diff --git a/img.c b/img.c @@ -538,7 +538,7 @@ end: */ static void buffer_to_bitmap(struct cached_image *cimg) { - unsigned short *tmp, *tmp1; + unsigned short *tmp = NULL, *tmp1; int ix, iy, ox, oy, gonna_be_smart; int *dregs; diff --git a/imgcache.c b/imgcache.c @@ -13,7 +13,7 @@ static struct list_head image_cache = { &image_cache, &image_cache }; /* xyw_meaning either MEANING_DIMS or MEANING_AUTOSCALE. */ struct cached_image *find_cached_image(int bg, unsigned char *url, int xw, int yw, int xyw_meaning, int scale, unsigned aspect) { - struct cached_image *i; + struct cached_image *i = NULL; struct list_head *li; if (xw >= 0 && yw >= 0 && xyw_meaning == MEANING_DIMS) { /* The xw and yw is already scaled so that scale and @@ -80,7 +80,7 @@ static unsigned long image_size(struct cached_image *cimg) static int shrink_image_cache(int u) { - struct cached_image *i; + struct cached_image *i = NULL; struct list_head *li; longlong si = 0; int r = 0; @@ -105,7 +105,7 @@ static int shrink_image_cache(int u) int imgcache_info(int type) { - struct cached_image *i; + struct cached_image *i = NULL; struct list_head *li; int n = 0; foreach(struct cached_image, i, li, image_cache) { diff --git a/kbd.c b/kbd.c @@ -44,7 +44,7 @@ int is_blocked(void) { #ifdef G if (F) { - struct terminal *term; + struct terminal *term = NULL; struct list_head *lterm; foreach(struct terminal, term, lterm, terminals) if (term->blocked != -1) diff --git a/links.h b/links.h @@ -160,8 +160,8 @@ do { \ static inline int test_int_overflow(int x, int y, int *result) { - int z = *result = (int)((unsigned)(x) + (unsigned)(y)); - return ~((unsigned)(x) ^ (unsigned)(y)) & ((unsigned)(x) ^ ((unsigned)(z))) & (1U << (sizeof(unsigned) * 8 - 1)); + int z = *result = x + y; + return ~(x ^ y) & (x ^ z) & (int)(1U << (sizeof(unsigned int) * 8 - 1)); } static inline int safe_add_function(int x, int y, unsigned char *file, int line) @@ -1236,7 +1236,10 @@ void exclude_rect_from_set(struct rect_set **, struct rect *); static inline void exclude_from_set(struct rect_set **s, int x1, int y1, int x2, int y2) { struct rect r; - r.x1 = x1, r.x2 = x2, r.y1 = y1, r.y2 = y2; + r.x1 = x1; + r.x2 = x2; + r.y1 = y1; + r.y2 = y2; exclude_rect_from_set(s, &r); } @@ -2569,7 +2572,7 @@ extern struct style *bfu_style_wb, *bfu_style_bw, *bfu_style_wb_b, *bfu_style_bw extern long bfu_bg_color, bfu_fg_color; struct memory_list { - int n; + size_t n; void *p[1]; }; diff --git a/main.c b/main.c @@ -227,7 +227,7 @@ void gfx_connection(int h) goto err_close; if (hard_read(h, (unsigned char *)&info_len, sizeof(int)) != sizeof(int) || info_len < 0) goto err_close; - info = xmalloc(info_len); + info = xmalloc((size_t)info_len); if (hard_read(h, info, info_len) != info_len) goto err_close_free; term = init_gfx_term(win_func, cwd, info, info_len); @@ -259,7 +259,7 @@ static void end_dump(struct object_request *r, void *p) ce = r->ce; if (dmp == D_SOURCE) { if (ce) { - struct fragment *frag; + struct fragment *frag = NULL; struct list_head *lfrag; nextfrag: foreach(struct fragment, frag, lfrag, ce->frag) if (frag->offset <= dump_pos && frag->offset + frag->length > dump_pos) { diff --git a/memory.c b/memory.c @@ -17,7 +17,7 @@ static struct list_head cache_upcalls = { &cache_upcalls, &cache_upcalls }; /* c int shrink_memory(int type) { - struct cache_upcall *c; + struct cache_upcall *c = NULL; struct list_head *lc; int a = 0; foreach(struct cache_upcall, c, lc, cache_upcalls) { @@ -38,7 +38,7 @@ void register_cache_upcall(int (*upcall)(int), int flags, unsigned char *name) void free_all_caches(void) { - struct cache_upcall *c; + struct cache_upcall *c = NULL; struct list_head *lc; int a, b; do { diff --git a/menu.c b/menu.c @@ -428,7 +428,7 @@ void go_backwards(struct terminal *term, void *id_ptr, void *ses_) { struct session *ses = (struct session *)ses_; unsigned want_id = (unsigned)(long)id_ptr; - struct location *l; + struct location *l = NULL; struct list_head *ll; int n = 0; foreach(struct location, l, ll, ses->history) { @@ -471,7 +471,7 @@ static void add_history_menu_entry(struct terminal *term, struct menu_item **mi, static void history_menu(struct terminal *term, void *ddd, void *ses_) { struct session *ses = (struct session *)ses_; - struct location *l; + struct location *l = NULL; struct list_head *ll; struct menu_item *mi = NULL; int n = 0; @@ -495,7 +495,7 @@ static const struct menu_item no_downloads_menu[] = { static void downloads_menu(struct terminal *term, void *ddd, void *ses_) { struct session *ses = (struct session *)ses_; - struct download *d; + struct download *d = NULL; struct list_head *ld; struct menu_item *mi = NULL; int n = 0; @@ -1138,7 +1138,7 @@ void reset_settings_for_tor(void) static void data_cleanup(void) { - struct session *ses; + struct session *ses = NULL; struct list_head *lses; reset_settings_for_tor(); foreach(struct session, ses, lses, sessions) { diff --git a/objreq.c b/objreq.c @@ -28,7 +28,7 @@ struct auth_dialog { static inline struct object_request *find_rq(tcount c) { - struct object_request *rq; + struct object_request *rq = NULL; struct list_head *lrq; foreach(struct object_request, rq, lrq, requests) if (rq->count == c) return rq; return NULL; @@ -210,7 +210,7 @@ static void cert_action(struct object_request *rq, int yes) static void cert_forall(struct cert_dialog *cs, int yes) { - struct object_request *rq; + struct object_request *rq = NULL; struct list_head *lrq; if (yes) add_blacklist_entry(cs->host, cs->bl); foreach(struct object_request, rq, lrq, requests) if (rq->term == cs->term && rq->hold == HOLD_CERT && rq->stat.state == cs->state) { diff --git a/os_dep.c b/os_dep.c @@ -282,13 +282,13 @@ int is_xterm(void) void close_fork_tty(void) { - struct terminal *t; + struct terminal *t = NULL; struct list_head *lt; - struct download *d; + struct download *d = NULL; struct list_head *ld; - struct connection *c; + struct connection *c = NULL; struct list_head *lc; - struct k_conn *k; + struct k_conn *k = NULL; struct list_head *lk; int rs; #ifndef NO_SIGNAL_HANDLERS diff --git a/sched.c b/sched.c @@ -33,7 +33,7 @@ static void check_keepalive_connections(void); unsigned long connect_info(int type) { int i = 0; - struct connection *ce; + struct connection *ce = NULL; struct list_head *lce; switch (type) { case CI_FILES: @@ -67,7 +67,7 @@ static int getpri(struct connection *c) static int connection_disappeared(struct connection *c, tcount count) { - struct connection *d; + struct connection *d = NULL; struct list_head *ld; foreach(struct connection, d, ld, queue) if (c == d && count == d->count) return 0; return 1; @@ -76,7 +76,7 @@ static int connection_disappeared(struct connection *c, tcount count) static struct h_conn *is_host_on_list(struct connection *c) { char *ho = (char *)get_host_name(c->url); - struct h_conn *h; + struct h_conn *h = NULL; struct list_head *lh; if (!ho) return NULL; @@ -127,7 +127,7 @@ static void stat_timer(void *c_) void setcstate(struct connection *c, int state) { - struct status *stat; + struct status *stat = NULL; struct list_head *lstat; if (c->state < 0 && state >= 0) c->prev_error = c->state; @@ -166,7 +166,7 @@ static struct k_conn *is_host_on_keepalive_list(struct connection *c) char *ho = (char *)get_keepalive_id(c->url); const int po = get_port(c->url); void (*ph)(struct connection *); - struct k_conn *h; + struct k_conn *h = NULL; struct list_head *lh; if (!(ph = get_protocol_handle(c->url))) return NULL; @@ -348,7 +348,7 @@ static void keepalive_timer(void *x) static void check_keepalive_connections(void) { - struct k_conn *kc; + struct k_conn *kc = NULL; struct list_head *lkc; uttime ct = get_absolute_time(); int p = 0; @@ -374,7 +374,7 @@ static void check_keepalive_connections(void) static void add_to_queue(struct connection *c) { - struct connection *cc; + struct connection *cc = NULL; struct list_head *lcc; int pri = getpri(c); foreach(struct connection, cc, lcc, queue) if (getpri(cc) > pri) break; @@ -383,7 +383,7 @@ static void add_to_queue(struct connection *c) static void sort_queue(void) { - struct connection *c, *n; + struct connection *c = NULL, *n; struct list_head *lc; int swp; do { @@ -418,7 +418,7 @@ static void suspend_connection(struct connection *c) static int try_to_suspend_connection(struct connection *c, unsigned char *ho) { int pri = getpri(c); - struct connection *d; + struct connection *d = NULL; struct list_head *ld; foreachback(struct connection, d, ld, queue) { if (getpri(d) <= pri) @@ -605,12 +605,12 @@ static int try_connection(struct connection *c) void check_queue(void *dummy) { - struct connection *c; + struct connection *c = NULL; struct list_head *lc; again: check_keepalive_connections(); foreach(struct connection, c, lc, queue) { - struct connection *d; + struct connection *d = NULL; struct list_head *ld; const int cp = getpri(c); foreachfrom(struct connection, d, ld, queue, &c->list_entry) { @@ -708,7 +708,7 @@ void load_url(unsigned char *url, unsigned char *prev_url, struct status *stat, int pri, int no_cache, int no_compress, int allow_flags, off_t position) { struct cache_entry *e = NULL; - struct connection *c; + struct connection *c = NULL; struct list_head *lc; unsigned char *u; int must_detach = 0; @@ -819,7 +819,7 @@ skip_cache: else if (no_cache >= NC_IF_MOD || !e) c->from = 0; else { - struct fragment *frag; + struct fragment *frag = NULL; struct list_head *lfrag; c->from = 0; foreach(struct fragment, frag, lfrag, e->frag) { @@ -1023,7 +1023,7 @@ void abort_all_connections(void) void abort_background_connections(void) { - struct connection *c; + struct connection *c = NULL; struct list_head *lc; again: foreach(struct connection, c, lc, queue) { @@ -1038,7 +1038,7 @@ again: int is_entry_used(struct cache_entry *e) { - struct connection *c; + struct connection *c = NULL; struct list_head *lc; foreach(struct connection, c, lc, queue) if (c->cache == e) @@ -1057,7 +1057,7 @@ static struct list_head blacklist = { &blacklist, &blacklist }; void add_blacklist_entry(unsigned char *host, int flags) { - struct blacklist_entry *b; + struct blacklist_entry *b = NULL; struct list_head *lb; size_t sl; foreach(struct blacklist_entry, b, lb, blacklist) @@ -1076,7 +1076,7 @@ void add_blacklist_entry(unsigned char *host, int flags) void del_blacklist_entry(unsigned char *host, int flags) { - struct blacklist_entry *b; + struct blacklist_entry *b = NULL; struct list_head *lb; foreach(struct blacklist_entry, b, lb, blacklist) if (!casestrcmp(host, b->host)) { @@ -1091,7 +1091,7 @@ void del_blacklist_entry(unsigned char *host, int flags) int get_blacklist_flags(unsigned char *host) { - struct blacklist_entry *b; + struct blacklist_entry *b = NULL; struct list_head *lb; foreach(struct blacklist_entry, b, lb, blacklist) if (!casestrcmp(host, b->host)) diff --git a/select.c b/select.c @@ -187,7 +187,7 @@ static struct list_head bottom_halves = { &bottom_halves, &bottom_halves }; void register_bottom_half(void (*fn)(void *), void *data) { - struct bottom_half *bh; + struct bottom_half *bh = NULL; struct list_head *lbh; foreach(struct bottom_half, bh, lbh, bottom_halves) if (bh->fn == fn && bh->data == data) @@ -200,7 +200,7 @@ void register_bottom_half(void (*fn)(void *), void *data) void unregister_bottom_half(void (*fn)(void *), void *data) { - struct bottom_half *bh; + struct bottom_half *bh = NULL; struct list_head *lbh; foreach(struct bottom_half, bh, lbh, bottom_halves) if (bh->fn == fn && bh->data == data) { @@ -355,7 +355,7 @@ static void set_event_for_timer(struct timer *tm) static void enable_libevent(void) { int i; - struct timer *tm; + struct timer *tm = NULL; struct list_head *ltm; if (disable_libevent) @@ -443,7 +443,7 @@ static uttime last_time; static void check_timers(void) { uttime interval = get_time() - last_time; - struct timer *t; + struct timer *t = NULL; struct list_head *lt; foreach(struct timer, t, lt, timers) { if (t->interval < interval) @@ -483,7 +483,7 @@ struct timer *install_timer(uttime t, void (*func)(void *), void *data) } else #endif { - struct timer *tt; + struct timer *tt = NULL; struct list_head *ltt; foreach(struct timer, tt, ltt, timers) if (tt->interval >= t) break; add_before_list_entry(ltt, &tm->list_entry); diff --git a/session.c b/session.c @@ -18,7 +18,7 @@ static void destroy_location(struct location *loc); int are_there_downloads(void) { - struct download *down; + struct download *down = NULL; struct list_head *ldown; foreach(struct download, down, ldown, downloads) if (!down->prog) return 1; return 0; @@ -124,7 +124,7 @@ unsigned char *get_err_msg(int state) { unsigned char *e; size_t sl; - struct strerror_val *s; + struct strerror_val *s = NULL; struct list_head *ls; if ((state >= S_MAX && state <= S__OK) || state >= S_WAIT) { int i; @@ -236,7 +236,7 @@ void change_screen_status(struct session *ses) if (fd->rq) stat = &fd->rq->stat; if (stat && stat->state == S__OK && fd->af) { unsigned count = 0; - struct additional_file *af; + struct additional_file *af = NULL; struct list_head *laf; foreachback(struct additional_file, af, laf, fd->af->af) { if (af->rq && af->rq->stat.state >= 0) { @@ -406,7 +406,7 @@ unsigned char *decode_url(unsigned char *url) struct session *get_download_ses(struct download *down) { - struct session *ses; + struct session *ses = NULL; struct list_head *lses; if (down) foreach(struct session, ses, lses, sessions) if (ses == down->ses) return ses; if (!list_empty(sessions)) return list_struct(sessions.next, struct session); @@ -477,7 +477,7 @@ static void abort_and_delete_download(void *down_) int test_abort_downloads_to_file(unsigned char *file, unsigned char *cwd, int abort_downloads) { int ret = 0; - struct download *down; + struct download *down = NULL; struct list_head *ldown; foreach(struct download, down, ldown, downloads) { if (strcmp(cast_const_char down->cwd, cast_const_char cwd)) { @@ -693,7 +693,7 @@ void display_download(struct terminal *term, void *down_, void *ses_) struct download *down = (struct download *)down_; struct session *ses = (struct session *)ses_; struct dialog *dlg; - struct download *dd; + struct download *dd = NULL; struct list_head *ldd; foreach(struct download, dd, ldd, downloads) if (dd == down) goto found; return; @@ -890,7 +890,7 @@ static void download_data(struct status *stat, void *down_) { struct download *down = (struct download *)down_; struct cache_entry *ce; - struct fragment *frag; + struct fragment *frag = NULL; struct list_head *lfrag; int rs; if (!(ce = stat->ce)) goto end_store; @@ -1239,7 +1239,7 @@ void abort_all_downloads(void) int f_is_finished(struct f_data *f) { - struct additional_file *af; + struct additional_file *af = NULL; struct list_head *laf; if (!f || f->rq->state >= 0) return 0; if (f->fd && f->fd->rq && f->fd->rq->state >= 0) return 0; @@ -1256,7 +1256,7 @@ static int f_is_cacheable(struct f_data *f) static int f_need_reparse(struct f_data *f) { - struct additional_file *af; + struct additional_file *af = NULL; struct list_head *laf; if (!f || f->rq->state >= 0) return 1; if (f->af) foreach(struct additional_file, af, laf, f->af->af) if (af->need_reparse > 0) return 1; @@ -1276,7 +1276,7 @@ static struct f_data *format_html(struct f_data_c *fd, struct object_request *rq if (f->rq->ce) { unsigned char *start; unsigned char *end; int stl = -1; - struct additional_file *af; + struct additional_file *af = NULL; struct list_head *laf; if (fd->af) foreach(struct additional_file, af, laf, fd->af->af) if (af->need_reparse > 0) af->need_reparse = 0; @@ -1312,7 +1312,7 @@ static struct f_data *format_html(struct f_data_c *fd, struct object_request *rq static void count_frames(struct f_data_c *fd, unsigned long *i) { - struct f_data_c *sub; + struct f_data_c *sub = NULL; struct list_head *lsub; if (!fd) return; if (fd->f_data) (*i)++; @@ -1322,7 +1322,7 @@ static void count_frames(struct f_data_c *fd, unsigned long *i) unsigned long formatted_info(int type) { unsigned long i = 0; - struct session *ses; + struct session *ses = NULL; struct list_head *lses; switch (type) { case CI_FILES: @@ -1341,7 +1341,7 @@ unsigned long formatted_info(int type) static void f_data_attach(struct f_data_c *fd, struct f_data *f) { - struct additional_file *af; + struct additional_file *af = NULL; struct list_head *laf; f->rq->upcall = fd_loaded; f->rq->data = fd; @@ -1363,7 +1363,7 @@ static void f_data_attach(struct f_data_c *fd, struct f_data *f) static inline int is_format_cache_entry_uptodate(struct f_data *f) { struct cache_entry *ce = f->rq->ce; - struct additional_file *af; + struct additional_file *af = NULL; struct list_head *laf; if (!ce || ce->count != f->use_tag) return 0; if (f->af) foreach(struct additional_file, af, laf, f->af->af) { @@ -1407,10 +1407,10 @@ static int shrink_format_cache(int u) int scc; int r = 0; int c = 0; - struct session *ses; + struct session *ses = NULL; struct list_head *lses; foreach(struct session, ses, lses, sessions) { - struct f_data *f; + struct f_data *f = NULL; struct list_head *lf; foreach(struct f_data, f, lf, ses->format_cache) { if (u == SH_FREE_ALL || !is_format_cache_entry_uptodate(f)) { @@ -1485,7 +1485,7 @@ static void calculate_scrollbars(struct f_data_c *fd, struct f_data *f) struct f_data *cached_format_html(struct f_data_c *fd, struct object_request *rq, unsigned char *url, struct document_options *opt, int *cch, int report_status) { struct session *ses = fd->ses; - struct f_data *f; + struct f_data *f = NULL; struct list_head *lf; if (fd->marginwidth != -1) { int marg = (fd->marginwidth + G_HTML_MARGIN - 1) / G_HTML_MARGIN; @@ -1603,7 +1603,7 @@ static void html_interpret(struct f_data_c *fd, int report_status) { int i; int oxw; int oyw; int oxp; int oyp; - struct f_data_c *sf; + struct f_data_c *sf = NULL; struct list_head *lsf; int cch; struct document_options o; @@ -1690,7 +1690,7 @@ static void html_interpret(struct f_data_c *fd, int report_status) void html_interpret_recursive(struct f_data_c *f) { - struct f_data_c *fd; + struct f_data_c *fd = NULL; struct list_head *lfd; if (f->rq) html_interpret(f, 1); foreach(struct f_data_c, fd, lfd, f->subframes) html_interpret_recursive(fd); @@ -1702,7 +1702,7 @@ void html_interpret_recursive(struct f_data_c *f) struct additional_file *request_additional_file(struct f_data *f, unsigned char *url_) { size_t sl; - struct additional_file *af; + struct additional_file *af = NULL; struct list_head *laf; unsigned char *url; url = stracpy(url_); @@ -1739,7 +1739,7 @@ struct additional_file *request_additional_file(struct f_data *f, unsigned char static void copy_additional_files(struct additional_files **a) { struct additional_files *afs; - struct additional_file *af; + struct additional_file *af = NULL; struct list_head *laf; if (!*a || (*a)->refcount == 1) return; (*a)->refcount--; @@ -1764,7 +1764,7 @@ static void image_timer(void *fd_) { struct f_data_c *fd = (struct f_data_c *)fd_; uttime now; - struct image_refresh *ir; + struct image_refresh *ir = NULL; struct list_head *lir; struct list_head neww; init_list(neww); @@ -1787,7 +1787,7 @@ static void image_timer(void *fd_) void refresh_image(struct f_data_c *fd, struct g_object *img, uttime tm) { - struct image_refresh *ir; + struct image_refresh *ir = NULL; struct list_head *lir; uttime now, e; if (!fd->f_data) return; @@ -1812,9 +1812,9 @@ void refresh_image(struct f_data_c *fd, struct g_object *img, uttime tm) void reinit_f_data_c(struct f_data_c *fd) { - struct additional_file *af; + struct additional_file *af = NULL; struct list_head *laf; - struct f_data_c *fd1; + struct f_data_c *fd1 = NULL; struct list_head *lfd1; #ifdef G if (F) @@ -2023,7 +2023,7 @@ static struct location *alloc_ses_location(struct session *ses) static void subst_location(struct f_data_c *fd, struct location *old, struct location *neww) { - struct f_data_c *f; + struct f_data_c *f = NULL; struct list_head *lf; foreach(struct f_data_c, f, lf, fd->subframes) subst_location(f, old, neww); if (fd->loc == old) fd->loc = neww; @@ -2031,7 +2031,7 @@ static void subst_location(struct f_data_c *fd, struct location *old, struct loc static struct location *copy_sublocations(struct session *ses, struct location *d, struct location *s, struct location *x) { - struct location *sl, *y; + struct location *sl = NULL, *y; struct list_head *lsl; d->name = stracpy(s->name); if (s == x) return d; @@ -2092,7 +2092,7 @@ static struct f_data_c *copy_location_and_replace_frame(struct session *ses, str */ struct f_data_c *find_frame(struct session *ses, unsigned char *target, struct f_data_c *base) { - struct f_data_c *f, *ff; + struct f_data_c *f, *ff = NULL; struct list_head *lff; if (!base) base = ses->screen; if (!target || !*target) return base; @@ -2689,7 +2689,7 @@ void map_selected(struct terminal *term, void *ld_, void *ses_) void go_back(struct session *ses, int num_steps) { - struct location *loc; + struct location *loc = NULL; struct list_head *lloc; int n; if (!num_steps) return; @@ -2722,7 +2722,7 @@ static void reload_frame(struct f_data_c *fd, int no_cache) { unsigned char *u; if (!list_empty(fd->subframes)) { - struct f_data_c *fdd; + struct f_data_c *fdd = NULL; struct list_head *lfdd; foreach(struct f_data_c, fdd, lfdd, fd->subframes) { reload_frame(fdd, no_cache); @@ -2829,7 +2829,7 @@ void *create_session_info(int cp, unsigned char *url, unsigned char *framename, static int read_session_info(struct session *ses, void *data, size_t len) { int cpfrom, sz, sz1; - struct session *s; + struct session *s = NULL; struct list_head *ls; if (len < 3 * sizeof(int)) return -1; @@ -2878,7 +2878,7 @@ static int read_session_info(struct session *ses, void *data, size_t len) void cleanup_session(struct session *ses) { - struct download *d; + struct download *d = NULL; struct list_head *ld; foreach(struct download, d, ld, downloads) if (d->ses == ses && d->prog) { ld = ld->prev; diff --git a/terminal.c b/terminal.c @@ -114,7 +114,7 @@ void redraw_below_window(struct window *win) { int tr; struct terminal *term = win->term; - struct window *w; + struct window *w = NULL; struct list_head *lw; struct links_event ev = { EV_REDRAW, 0, 0, 0 }; ev.x = term->x; @@ -132,7 +132,7 @@ void redraw_below_window(struct window *win) static void redraw_terminal_ev(struct terminal *term, int e) { - struct window *win; + struct window *win = NULL; struct list_head *lwin; struct links_event ev = {0, 0, 0, 0}; ev.ev = e; @@ -170,7 +170,7 @@ static void redraw_terminal_cls(struct terminal *term) void cls_redraw_all_terminals(void) { - struct terminal *term; + struct terminal *term = NULL; struct list_head *lterm; foreach(struct terminal, term, lterm, terminals) { if (!F) redraw_terminal_cls(term); @@ -184,7 +184,7 @@ void cls_redraw_all_terminals(void) void draw_to_window(struct window *win, void (*fn)(struct terminal *term, void *), void *data) { struct terminal *term = win->term; - struct window *w; + struct window *w = NULL; struct list_head *lw; if (!F) { pr(fn(term, data)) {}; @@ -237,9 +237,9 @@ void draw_to_window(struct window *win, void (*fn)(struct terminal *term, void * static void redraw_windows(void *term_) { struct terminal *term = (struct terminal *)term_; - struct terminal *t1; + struct terminal *t1 = NULL; struct list_head *lt1; - struct window *win; + struct window *win = NULL; struct list_head *lwin; foreach(struct terminal, t1, lt1, terminals) if (t1 == term) goto ok; return; @@ -264,7 +264,7 @@ void set_window_pos(struct window *win, int x1, int y1, int x2, int y2) r.x2 = x2; r.y2 = y2; if (is_rect_valid(&win->pos) && (x1 > win->pos.x1 || x2 < win->pos.x2 || y1 > win->pos.y1 || y2 < win->pos.y2) && term->redrawing < 2) { - struct window *w; + struct window *w = NULL; struct list_head *lw; foreachfrom(struct window, w, lw, term->windows, win->list_entry.next) unite_rect(&w->redr, &win->pos, &w->redr); register_bottom_half(redraw_windows, term); @@ -305,7 +305,7 @@ void delete_window(struct window *win) if (!F) redraw_terminal(term); #ifdef G else { - struct window *w; + struct window *w = NULL; struct list_head *lw; foreachfrom(struct window, w, lw, term->windows, nxw) unite_rect(&w->redr, &win->pos, &w->redr); register_bottom_half(redraw_windows, term); @@ -419,7 +419,7 @@ static struct term_spec *default_term_spec(unsigned char *term) static struct term_spec *get_term_spec(unsigned char *term) { - struct term_spec *t; + struct term_spec *t = NULL; struct list_head *lt; foreach(struct term_spec, t, lt, term_specs) if (!casestrcmp(t->term, term)) return t; return default_term_spec(term); @@ -427,14 +427,14 @@ static struct term_spec *get_term_spec(unsigned char *term) static void sync_term_specs(void) { - struct terminal *term; + struct terminal *term = NULL; struct list_head *lterm; foreach(struct terminal, term, lterm, terminals) term->spec = get_term_spec(term->term); } struct term_spec *new_term_spec(unsigned char *term) { - struct term_spec *t; + struct term_spec *t = NULL; struct list_head *lt; foreach(struct term_spec, t, lt, term_specs) if (!casestrcmp(t->term, term)) return t; t = xmalloc(sizeof(struct term_spec)); @@ -576,7 +576,7 @@ struct terminal *init_gfx_term(void (*root_window)(struct window *, struct links void t_redraw(struct graphics_device *dev, struct rect *r) { struct terminal *term = dev->user_data; - struct window *win; + struct window *win = NULL; struct list_head *lwin; foreach(struct window, win, lwin, term->windows) unite_rect(&win->redr, r, &win->redr); register_bottom_half(redraw_windows, term); @@ -585,7 +585,7 @@ void t_redraw(struct graphics_device *dev, struct rect *r) void t_resize(struct graphics_device *dev) { struct terminal *term = dev->user_data; - struct window *win; + struct window *win = NULL; struct list_head *lwin; struct links_event ev = { EV_RESIZE, 0, 0, 0 }; term->x = ev.x = dev->size.x2; @@ -700,7 +700,7 @@ static void in_term(void *term_) sync_term_specs(); } if (ev->ev == EV_REDRAW || ev->ev == EV_RESIZE || ev->ev == EV_INIT) { - struct window *win; + struct window *win = NULL; struct list_head *lwin; term->real_x = ev->x; @@ -717,7 +717,8 @@ static void in_term(void *term_) clear_terminal(term); erase_screen(term); term->redrawing = 1; - foreachback(struct window, win, lwin, term->windows) win->handler(win, ev, 0); + foreachback(struct window, win, lwin, term->windows) + win->handler(win, ev, 0); term->redrawing = 0; } if (ev->ev == EV_MOUSE) { @@ -914,7 +915,7 @@ static void redraw_screen(struct terminal *term) void redraw_all_terminals(void) { - struct terminal *term; + struct terminal *term = NULL; struct list_head *lterm; foreach(struct terminal, term, lterm, terminals) redraw_screen(term); } @@ -1281,7 +1282,7 @@ void set_terminal_title(struct terminal *term, unsigned char *title) struct terminal *find_terminal(tcount count) { - struct terminal *term; + struct terminal *term = NULL; struct list_head *lterm; foreach(struct terminal, term, lterm, terminals) if (term->count == count) return term; return NULL; diff --git a/types.c b/types.c @@ -360,7 +360,7 @@ static struct list *assoc_find_item(struct list *s, unsigned char *str, int dire void update_assoc(struct assoc *neww) { struct assoc *repl; - struct list *r; + struct list *r = NULL; struct list_head *lr; if (!neww->label[0] || !neww->ct[0] || !neww->prog[0]) return; @@ -684,7 +684,7 @@ static struct list *ext_find_item(struct list *s, unsigned char *str, int direct void update_ext(struct extension *neww) { struct extension *repl; - struct list *r; + struct list *r = NULL; struct list_head *lr; if (!neww->ext[0] || !neww->ct[0]) return; @@ -706,7 +706,7 @@ void update_ext(struct extension *neww) void update_prog(struct list_head *l, unsigned char *p, int s) { - struct protocol_program *repl; + struct protocol_program *repl = NULL; struct list_head *lrepl; foreach(struct protocol_program, repl, lrepl, *l) if (repl->system == s) { free(repl->prog); @@ -722,7 +722,7 @@ ss: unsigned char *get_prog(struct list_head *l) { - struct protocol_program *repl; + struct protocol_program *repl = NULL; struct list_head *lrepl; foreach(struct protocol_program, repl, lrepl, *l) if (repl->system == SYSTEM_ID) return repl->prog; update_prog(l, cast_uchar "", SYSTEM_ID); @@ -962,7 +962,7 @@ unsigned char *get_compress_by_extension(char *ext, char *ext_end) unsigned char *get_content_type_by_extension(unsigned char *url) { - struct list *l; + struct list *l = NULL; struct list_head *ll; unsigned char *ct, *eod, *ext, *exxt; int extl, el; @@ -1054,7 +1054,7 @@ static unsigned char *get_content_type_by_header_and_extension(unsigned char *he static unsigned char *get_extension_by_content_type(unsigned char *ct) { - struct list *l; + struct list *l = NULL; struct list_head *ll; unsigned char *x, *y; if (is_html_type(ct)) @@ -1248,7 +1248,7 @@ unsigned char *encoding_2_extension(unsigned char *encoding) struct assoc *get_type_assoc(struct terminal *term, unsigned char *type, int *n) { struct assoc *assoc_array; - struct list *l; + struct list *l = NULL; struct list_head *ll; int count = 0; foreach(struct list, l, ll, assoc.list_entry) { @@ -1449,7 +1449,7 @@ unsigned char *get_filename_from_url(unsigned char *url, unsigned char *head, in static void free_prog_list(struct list_head *l) { struct list_head *lp; - struct protocol_program *p; + struct protocol_program *p = NULL; foreach(struct protocol_program, p, lp, *l) free(p->prog); free_list(struct protocol_program, *l); @@ -1457,7 +1457,7 @@ static void free_prog_list(struct list_head *l) void free_types(void) { - struct list *l; + struct list *l = NULL; struct list_head *ll; foreach(struct list, l, ll, assoc.list_entry) { struct assoc *a = get_struct(l, struct assoc, head); diff --git a/view.c b/view.c @@ -104,7 +104,7 @@ static void set_link(struct f_data_c *f) static int find_tag(struct f_data *f, unsigned char *name) { - struct tag *tag; + struct tag *tag = NULL; struct list_head *ltag; unsigned char *tt; int ll; @@ -958,7 +958,7 @@ void draw_doc(struct terminal *t, void *scr_) } check_vs(scr); if (scr->f_data->frame_desc) { - struct f_data_c *f; + struct f_data_c *f = NULL; struct list_head *lf; int n; if (!F) { @@ -1041,7 +1041,7 @@ void draw_doc(struct terminal *t, void *scr_) static void clr_xl(struct f_data_c *fd) { - struct f_data_c *fdd; + struct f_data_c *fdd = NULL; struct list_head *lfdd; fd->xl = fd->yl = -1; foreach(struct f_data_c, fdd, lfdd, fd->subframes) clr_xl(fdd); @@ -1373,7 +1373,7 @@ static void x_end(struct session *ses, struct f_data_c *f, int a) static int has_form_submit(struct f_data *f, struct form_control *form) { - struct form_control *i; + struct form_control *i = NULL; struct list_head *li; int q = 0; foreach (struct form_control, i, li, f->forms) if (i->form_num == form->form_num) { @@ -1397,7 +1397,7 @@ struct submitted_value { static void free_succesful_controls(struct list_head *submit) { - struct submitted_value *v; + struct submitted_value *v = NULL; struct list_head *lv; foreach(struct submitted_value, v, lv, *submit) { free(v->name); @@ -1428,7 +1428,7 @@ static int compare_submitted(struct submitted_value *sub1, struct submitted_valu static void get_succesful_controls(struct f_data_c *f, struct form_control *fc, struct list_head *subm) { int ch; - struct form_control *form; + struct form_control *form = NULL; struct list_head *lform; init_list(*subm); foreach(struct form_control, form, lform, f->f_data->forms) { @@ -1489,7 +1489,7 @@ static void get_succesful_controls(struct f_data_c *f, struct form_control *fc, } } do { - struct submitted_value *sub, *nx; + struct submitted_value *sub = NULL, *nx; struct list_head *lsub; ch = 0; foreach(struct submitted_value, sub, lsub, *subm) if (sub->list_entry.next != subm) { @@ -1543,7 +1543,7 @@ static void encode_string(unsigned char *name, unsigned char **data, int *len) static void encode_controls(struct list_head *l, unsigned char **data, int *len, int cp_from, int cp_to) { - struct submitted_value *sv; + struct submitted_value *sv = NULL; struct list_head *lsv; int lst = 0; unsigned char *p2; @@ -1700,7 +1700,7 @@ static void encode_multipart(struct session *ses, struct list_head *l, unsigned void reset_form(struct f_data_c *f, int form_num) { - struct form_control *form; + struct form_control *form = NULL; struct list_head *lform; foreach(struct form_control, form, lform, f->f_data->forms) if (form->form_num == form_num) { struct form_state *fs; @@ -1899,7 +1899,7 @@ int enter(struct session *ses, struct f_data_c *f, int a) if (link->form->ro) return 1; if (link->form->type == FC_CHECKBOX) fs->state = !fs->state; else { - struct form_control *fc; + struct form_control *fc = NULL; struct list_head *lfc; #ifdef G int re = 0; @@ -2192,7 +2192,10 @@ int field_op(struct session *ses, struct f_data_c *f, struct link *l, struct lin if (fs->state > ftce->ln[y - 1].en_offs) fs->state = ftce->ln[y - 1].en_offs; } else goto b; - } else r = 0, f->vs->brl_in_field = 0; + } else { + r = 0; + f->vs->brl_in_field = 0; + } } else if (ev->x == KBD_DOWN) { if (form->type == FC_TEXTAREA) { ftce = format_text(f, form, fs); @@ -2201,10 +2204,14 @@ int field_op(struct session *ses, struct f_data_c *f, struct link *l, struct lin if (y >= ftce->n_lines - 1) goto b; fs->state = (int)(textptr_add(fs->string + ftce->ln[y + 1].st_offs, textptr_diff(fs->string + fs->state, fs->string + ftce->ln[y].st_offs, f->f_data->opt.cp), f->f_data->opt.cp) - fs->string); - if (fs->state > ftce->ln[y + 1].en_offs) fs->state = ftce->ln[y + 1].en_offs; + if (fs->state > ftce->ln[y + 1].en_offs) + fs->state = ftce->ln[y + 1].en_offs; } else goto b; - } else r = 0, f->vs->brl_in_field = 0; + } else { + r = 0; + f->vs->brl_in_field = 0; + } } else if ((ev->x == KBD_INS && ev->y & KBD_CTRL) || (upcase(ev->x) == 'B' && ev->y & KBD_CTRL) || ev->x == KBD_COPY) { set_br_pos(f, l); set_clipboard_text(ses->term, fs->string); @@ -2711,7 +2718,7 @@ static int frame_ev(struct session *ses, struct f_data_c *fd, struct links_event struct f_data_c *current_frame(struct session *ses) { - struct f_data_c *fd, *fdd; + struct f_data_c *fd, *fdd = NULL; struct list_head *lfdd; fd = ses->screen; while (!list_empty(fd->subframes)) { @@ -2729,7 +2736,7 @@ struct f_data_c *current_frame(struct session *ses) static int is_active_frame(struct session *ses, struct f_data_c *f) { - struct f_data_c *fd, *fdd; + struct f_data_c *fd, *fdd = NULL; struct list_head *lfdd; fd = ses->screen; if (f == fd) return 1; @@ -2777,7 +2784,7 @@ void next_frame(struct session *ses, int p) { int n; struct view_state *vs; - struct f_data_c *fd, *fdd; + struct f_data_c *fd, *fdd = NULL; struct list_head *lfdd; if (!(fd = current_frame(ses))) return;