1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-27 01:25:34 +00:00

Fix compiler errors without HAVE_VARIADIC_MACROS.

This commit is contained in:
Kalle Olavi Niemitalo 2007-03-11 12:22:02 +02:00 committed by Kalle Olavi Niemitalo
parent dc9175795a
commit 801d520ddd
23 changed files with 50 additions and 44 deletions

View File

@ -43,7 +43,7 @@ add_listbox_item(struct hierbox_browser *browser, struct listbox_item *root,
struct listbox_item *item;
if (!root) {
assertm(browser, "Nowhere to add new list box item");
assertm(browser != NULL, "Nowhere to add new list box item");
root = &browser->root;
}

View File

@ -171,7 +171,7 @@ select_menu_item(struct terminal *term, struct menu_item *it, void *data)
return;
}
assertm(func, "No menu function");
assertm(func != NULL, "No menu function");
if_assert_failed return;
func(term, it_data, data);

View File

@ -602,7 +602,7 @@ bookmark_search_do(void *data)
struct listbox_data *box;
struct dialog_data *dlg_data;
assertm(dlg->udata, "Bookmark search with NULL udata in dialog");
assertm(dlg->udata != NULL, "Bookmark search with NULL udata in dialog");
if_assert_failed return;
ctx.title = dlg->widgets[0].data;

View File

@ -197,7 +197,7 @@ get_opt_rec(struct option *tree, const unsigned char *name_)
if (tree && tree->flags & OPT_AUTOCREATE && !no_autocreate) {
struct option *template = get_opt_rec(tree, "_template_");
assertm(template, "Requested %s should be autocreated but "
assertm(template != NULL, "Requested %s should be autocreated but "
"%.*s._template_ is missing!", name_, sep - name_,
name_);
if_assert_failed {
@ -391,7 +391,7 @@ add_opt_rec(struct option *tree, unsigned char *path, struct option *option)
assert(path && option && tree);
if (*path) tree = get_opt_rec(tree, path);
assertm(tree, "Missing option tree for '%s'", path);
assertm(tree != NULL, "Missing option tree for '%s'", path);
if (!tree->value.tree) return;
object_nolock(option, "option");

View File

@ -94,7 +94,7 @@ exec_cmd(struct option *o, unsigned char ***argv, int *argc)
{ \
struct option *real = get_opt_rec(config_options, opt->value.string); \
\
assertm(real, "%s aliased to unknown option %s!", opt->name, opt->value.string); \
assertm(real != NULL, "%s aliased to unknown option %s!", opt->name, opt->value.string); \
if_assert_failed { return ret_; } \
\
if (option_types[real->type].name_) \
@ -109,7 +109,7 @@ redir_cmd(struct option *opt, unsigned char ***argv, int *argc)
struct option *real = get_opt_rec(config_options, opt->value.string);
unsigned char * ret = NULL;
assertm(real, "%s aliased to unknown option %s!", opt->name, opt->value.string);
assertm(real != NULL, "%s aliased to unknown option %s!", opt->name, opt->value.string);
if_assert_failed { return ret; }
if (option_types[real->type].cmdline) {
@ -131,7 +131,7 @@ redir_wr(struct option *opt, struct string *string)
{
struct option *real = get_opt_rec(config_options, opt->value.string);
assertm(real, "%s aliased to unknown option %s!", opt->name, opt->value.string);
assertm(real != NULL, "%s aliased to unknown option %s!", opt->name, opt->value.string);
if_assert_failed { return; }
if (option_types[real->type].write)
@ -144,7 +144,7 @@ redir_set(struct option *opt, unsigned char *str)
struct option *real = get_opt_rec(config_options, opt->value.string);
int ret = 0;
assertm(real, "%s aliased to unknown option %s!", opt->name, opt->value.string);
assertm(real != NULL, "%s aliased to unknown option %s!", opt->name, opt->value.string);
if_assert_failed { return ret; }
if (option_types[real->type].set) {

View File

@ -196,7 +196,7 @@ again:
}
if (wanted) {
assertm(limits, "bug in distribute_values()");
assertm(limits != NULL, "bug in distribute_values()");
limits = NULL;
sum = 0;
goto again;

View File

@ -371,7 +371,7 @@ init_dom_node_at(
int sort = (type == DOM_NODE_ATTRIBUTE);
int index;
assertm(list, "Adding node %d to bad parent %d",
assertm(list != NULL, "Adding node %d to bad parent %d",
node->type, parent->type);
index = *list && (*list)->size > 0 && sort

View File

@ -488,7 +488,7 @@ parse_dom_select(struct dom_select *select, struct dom_stack *stack,
int sort = (node->type == DOM_NODE_ATTRIBUTE);
int index;
assertm(list, "Adding node to bad parent [%d -> %d]",
assertm(list != NULL, "Adding node to bad parent [%d -> %d]",
node->type, parent->type);
index = *list && (*list)->size > 0 && sort

View File

@ -189,7 +189,7 @@ get_dom_stack_state_data(struct dom_stack_context *context,
if (!object_size) return NULL;
assertm(context->state_objects);
assert(context->state_objects);
return (void *) &context->state_objects[state->depth * object_size];
}

View File

@ -311,7 +311,9 @@ ecmascript_timeout_handler(void *i)
{
struct ecmascript_interpreter *interpreter = i;
assertm(interpreter->vs->doc_view, "setTimeout: vs with no document (e_f %d)", interpreter->vs->ecmascript_fragile);
assertm(interpreter->vs->doc_view != NULL,
"setTimeout: vs with no document (e_f %d)",
interpreter->vs->ecmascript_fragile);
interpreter->vs->doc_view->document->timeout = TIMER_ID_UNDEF;
/* The expired timer ID has now been erased. */

View File

@ -132,7 +132,7 @@ get_event_id(unsigned char *name)
if (item) {
struct event *event = item->value;
assertm(event, "Hash item with no value");
assertm(event != NULL, "Hash item with no value");
if_assert_failed return EVENT_NONE;
return event->id;

View File

@ -1015,7 +1015,7 @@ cancel_download(struct download *download, int interrupt)
if (is_in_result_state(download->state))
return;
assertm(download->conn, "last state is %d", download->state);
assertm(download->conn != NULL, "last state is %d", download->state);
check_queue_bugs();
@ -1074,7 +1074,7 @@ move_download(struct download *old, struct download *new,
return;
}
assertm(old->conn, "last state is %d", old->state);
assertm(old->conn != NULL, "last state is %d", old->state);
conn->pri[new->pri]++;
add_to_list(conn->downloads, new);

View File

@ -455,7 +455,7 @@ connected(struct socket *socket)
int err = 0;
socklen_t len = sizeof(err);
assertm(socket->connect_info, "Lost connect_info!");
assertm(socket->connect_info != NULL, "Lost connect_info!");
if_assert_failed return;
if (getsockopt(socket->fd, SOL_SOCKET, SO_ERROR, (void *) &err, &len) == 0) {
@ -672,7 +672,7 @@ write_select(struct socket *socket)
struct write_buffer *wb = socket->write_buffer;
int wr;
assertm(wb, "write socket has no buffer");
assertm(wb != NULL, "write socket has no buffer");
if_assert_failed {
socket->ops->done(socket, S_INTERNAL);
return;
@ -802,7 +802,7 @@ read_select(struct socket *socket)
struct read_buffer *rb = socket->read_buffer;
ssize_t rd;
assertm(rb, "read socket has no buffer");
assertm(rb != NULL, "read socket has no buffer");
if_assert_failed {
socket->ops->done(socket, S_INTERNAL);
return;

View File

@ -379,7 +379,7 @@ add_piece_to_bittorrent_free_list(struct bittorrent_piece_cache *cache,
return NULL;
}
assertm(piece_offset == piece_length);
assert(piece_offset == piece_length);
assertm(blocks, "Piece was not divided into blocks");
assert(!cache->entries[piece].blocks);
@ -1221,7 +1221,7 @@ update_bittorrent_piece_cache_state(struct bittorrent_connection *bittorrent)
foreachsafe (entry, next, cache->queue) {
uint32_t piece_length, piece;
assertm(entry->data && entry->completed);
assert(entry->data && entry->completed);
piece = entry - cache->entries;

View File

@ -194,7 +194,7 @@ parse_uri(struct uri *uri, unsigned char *uristring)
unsigned char *lbracket, *rbracket;
#endif
assertm(uristring, "No uri to parse.");
assertm(uristring != NULL, "No uri to parse.");
memset(uri, 0, sizeof(*uri));
/* Nothing to do for an empty url. */
@ -923,7 +923,7 @@ join_urls(struct uri *base, unsigned char *rel)
}
}
assertm(base->data, "bad base url");
assertm(base->data != NULL, "bad base url");
if_assert_failed return NULL;
path = base->data;
@ -1201,7 +1201,7 @@ parse_uri:
? uri.port + uri.portlen - struri(&uri)
: uri.host + uri.hostlen - struri(&uri) + uri.ipv6 /* ']' */;
assertm(uri.host, "uri.host not set after no host slash error");
assertm(uri.host != NULL, "uri.host not set after no host slash error");
insert_in_string(&newurl, offset, "/", 1);
goto parse_uri;
}
@ -1596,7 +1596,7 @@ done_uri(struct uri *uri)
item = get_hash_item(uri_cache.map, string, length);
entry = item ? item->value : NULL;
assertm(entry, "Releasing unknown URI [%s]", string);
assertm(entry != NULL, "Releasing unknown URI [%s]", string);
del_hash_item(uri_cache.map, item);
mem_free(entry);

View File

@ -463,7 +463,7 @@ do_move(struct session *ses, struct download **download_p)
struct cache_entry *cached;
assert(download_p && *download_p);
assertm(ses->loading_uri, "no ses->loading_uri");
assertm(ses->loading_uri != NULL, "no ses->loading_uri");
if_assert_failed return DO_MOVE_ABORT;
if (ses->loading_uri->protocol == PROTOCOL_UNKNOWN)

View File

@ -124,7 +124,7 @@ term_send_event(struct terminal *term, struct term_event *ev)
win = term->windows.next;
if (win->type == WINDOW_TAB) {
win = get_current_tab(term);
assertm(win, "No tab to send the event to!");
assertm(win != NULL, "No tab to send the event to!");
if_assert_failed return;
}

View File

@ -596,7 +596,7 @@ fastfind_search(struct fastfind_index *index, unsigned char *key, int key_len)
info = index->handle;
assertm(info, "FastFind index %s not initialized", index->comment);
assertm(info != NULL, "FastFind index %s not initialized", index->comment);
if_assert_failed return NULL;
FF_DBG_search_stats(info, key_len);

View File

@ -26,7 +26,7 @@
/* Create a memory list. If p is NULL or allocation fails, it will
* returns NULL.
* It always stops at first NULL element. */
#ifdef DEBUG_MEMLIST
#if defined(DEBUG_MEMLIST) && defined(HAVE_VARIADIC_MACROS)
struct memory_list *
debug_getml(unsigned char *file, int line, void *p, ...)
#else
@ -69,7 +69,7 @@ getml(void *p, ...)
* If memory list exists, it enlarges it, else it creates it.
* if there's no elements or first element is NULL, it does nothing.
* It always stops at first NULL element. */
#ifdef DEBUG_MEMLIST
#if defined(DEBUG_MEMLIST) && defined(HAVE_VARIADIC_MACROS)
void
debug_add_to_ml(unsigned char *file, int line, struct memory_list **ml, ...)
#else
@ -89,7 +89,11 @@ add_to_ml(struct memory_list **ml, ...)
/* None, so just return. */
if (!n) {
#ifdef DEBUG_MEMLIST
#ifdef HAVE_VARIADIC_MACROS
errline = line, errfile = file;
#else
errline = 0, errfile = "?";
#endif
elinks_error("add_to_ml(%p, NULL, ...)", ml);
#endif
return;

View File

@ -139,7 +139,7 @@ straconcat(const unsigned char *str, ...)
unsigned char *s;
unsigned int len;
assertm(str, "[straconcat]");
assertm(str != NULL, "[straconcat]");
if_assert_failed { return NULL; }
len = strlen(str);
@ -250,7 +250,7 @@ init_string__(const unsigned char *file, int line, struct string *string)
init_string(struct string *string)
#endif
{
assertm(string, "[init_string]");
assertm(string != NULL, "[init_string]");
if_assert_failed { return NULL; }
string->length = 0;
@ -271,7 +271,7 @@ init_string(struct string *string)
inline void
done_string(struct string *string)
{
assertm(string, "[done_string]");
assertm(string != NULL, "[done_string]");
if_assert_failed { return; }
if (string->source) {
@ -302,7 +302,7 @@ add_to_string(struct string *string, const unsigned char *source)
inline struct string *
add_crlf_to_string(struct string *string)
{
assertm(string, "[add_crlf_to_string]");
assertm(string != NULL, "[add_crlf_to_string]");
if_assert_failed { return NULL; }
check_string_magic(string);
@ -377,7 +377,7 @@ string_concat(struct string *string, ...)
va_list ap;
const unsigned char *source;
assertm(string, "[string_concat]");
assertm(string != NULL, "[string_concat]");
if_assert_failed { return NULL; }
check_string_magic(string);
@ -496,7 +496,7 @@ add_to_string_list(struct list_head *list, const unsigned char *source,
void
free_string_list(struct list_head *list)
{
assertm(list, "[free_string_list]");
assertm(list != NULL, "[free_string_list]");
if_assert_failed return;
while (!list_empty(*list)) {

View File

@ -322,7 +322,7 @@ draw_form_entry(struct terminal *term, struct document_view *doc_view,
if_assert_failed return;
fc = get_link_form_control(link);
assertm(fc, "link %d has no form control", (int) (link - doc_view->document->links));
assertm(fc != NULL, "link %d has no form control", (int) (link - doc_view->document->links));
if_assert_failed return;
fs = find_form_state(doc_view, fc);
@ -1366,7 +1366,7 @@ field_op(struct session *ses, struct document_view *doc_view,
if_assert_failed return FRAME_EVENT_OK;
fc = get_link_form_control(link);
assertm(fc, "link has no form control");
assertm(fc != NULL, "link has no form control");
if_assert_failed return FRAME_EVENT_OK;
if (fc->mode == FORM_MODE_DISABLED || ev->ev != EVENT_KBD

View File

@ -1372,7 +1372,7 @@ text_typeahead_handler(struct input_line *line, int action_id)
int report_errors = action_id == -1;
enum find_error error;
assertm(doc_view, "document not formatted");
assertm(doc_view != NULL, "document not formatted");
if_assert_failed return INPUT_LINE_CANCEL;
switch (action_id) {
@ -1437,7 +1437,7 @@ link_typeahead_handler(struct input_line *line, int action_id)
struct document_view *doc_view = current_frame(ses);
int offset = 0;
assertm(doc_view, "document not formatted");
assertm(doc_view != NULL, "document not formatted");
if_assert_failed return INPUT_LINE_CANCEL;
/* If there is nothing to match with don't start searching */

View File

@ -330,7 +330,7 @@ draw_textarea_utf8(struct terminal *term, struct form_state *fs,
assert(term && doc_view && doc_view->document && doc_view->vs && link);
if_assert_failed return;
fc = get_link_form_control(link);
assertm(fc, "link %d has no form control", (int) (link - doc_view->document->links));
assertm(fc != NULL, "link %d has no form control", (int) (link - doc_view->document->links));
if_assert_failed return;
box = &doc_view->box;
@ -419,7 +419,7 @@ draw_textarea(struct terminal *term, struct form_state *fs,
}
#endif /* CONFIG_UTF8 */
fc = get_link_form_control(link);
assertm(fc, "link %d has no form control", (int) (link - doc_view->document->links));
assertm(fc != NULL, "link %d has no form control", (int) (link - doc_view->document->links));
if_assert_failed return;
box = &doc_view->box;
@ -1206,7 +1206,7 @@ set_textarea(struct document_view *doc_view, int direction)
return;
fc = get_link_form_control(link);
assertm(fc, "link has no form control");
assertm(fc != NULL, "link has no form control");
if_assert_failed return;
if (fc->mode == FORM_MODE_DISABLED) return;