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

[mem_alloc] cast return value

This commit is contained in:
Witold Filipczyk 2022-01-16 19:09:27 +01:00
parent 75a0b14748
commit 20c161559c
77 changed files with 116 additions and 116 deletions

View File

@ -159,7 +159,7 @@ init_widget(struct dialog_data *dlg_data, int i)
widget_data->widget = &dlg_data->dlg->widgets[i]; widget_data->widget = &dlg_data->dlg->widgets[i];
if (widget_data->widget->datalen) { if (widget_data->widget->datalen) {
widget_data->cdata = mem_alloc(widget_data->widget->datalen); widget_data->cdata = (char *)mem_alloc(widget_data->widget->datalen);
if (!widget_data->cdata) { if (!widget_data->cdata) {
return NULL; return NULL;
} }

View File

@ -219,7 +219,7 @@ hierbox_ev_init(struct dialog_data *dlg_data)
/* If we fail here it only means automatic updating /* If we fail here it only means automatic updating
* will not be possible so no need to panic. */ * will not be possible so no need to panic. */
item = mem_alloc(sizeof(*item)); item = (struct hierbox_dialog_list_item *)mem_alloc(sizeof(*item));
if (item) { if (item) {
item->dlg_data = dlg_data; item->dlg_data = dlg_data;
add_to_list(browser->dialogs, item); add_to_list(browser->dialogs, item);

View File

@ -365,7 +365,7 @@ init_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
struct input_history_entry *new_entry; struct input_history_entry *new_entry;
/* One byte is reserved in struct input_history_entry. */ /* One byte is reserved in struct input_history_entry. */
new_entry = mem_alloc(sizeof(*new_entry) + datalen); new_entry = (struct input_history_entry *)mem_alloc(sizeof(*new_entry) + datalen);
if (!new_entry) continue; if (!new_entry) continue;
memcpy(new_entry->data, entry->data, datalen + 1); memcpy(new_entry->data, entry->data, datalen + 1);

View File

@ -260,7 +260,7 @@ add_to_input_history(struct input_history *history, char *data,
/* Copy it all etc. */ /* Copy it all etc. */
/* One byte is already reserved for url in struct input_history_item. */ /* One byte is already reserved for url in struct input_history_item. */
entry = mem_alloc(sizeof(*entry) + length); entry = (struct input_history_entry *)mem_alloc(sizeof(*entry) + length);
if (!entry) return; if (!entry) return;
memcpy(entry->data, data, length + 1); memcpy(entry->data, data, length + 1);

View File

@ -103,7 +103,7 @@ msg_text_do(char *format, va_list ap)
va_copy(ap2, ap); va_copy(ap2, ap);
infolen = vsnprintf(NULL, 0, format, ap2); infolen = vsnprintf(NULL, 0, format, ap2);
info = mem_alloc(infolen + 1); info = (char *)mem_alloc(infolen + 1);
if (!info) return NULL; if (!info) return NULL;
len = vsnprintf((char *) info, infolen + 1, format, ap); len = vsnprintf((char *) info, infolen + 1, format, ap);

View File

@ -308,7 +308,7 @@ delete_whites(const char *s)
int last_was_space = 0, c = 0, i; int last_was_space = 0, c = 0, i;
int len = strlen(s); int len = strlen(s);
r = mem_alloc(len + 1); r = (char *)mem_alloc(len + 1);
if (!r) return NULL; if (!r) return NULL;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
@ -350,7 +350,7 @@ on_text(void *data, const XML_Char *text, int len)
if (len) { if (len) {
len2 = current_node->text ? strlen(current_node->text) : 0; len2 = current_node->text ? strlen(current_node->text) : 0;
tmp = mem_realloc(current_node->text, (size_t) (len + 1 + len2)); tmp = (char *)mem_realloc(current_node->text, (size_t) (len + 1 + len2));
/* Out of memory */ /* Out of memory */
if (!tmp) return; if (!tmp) return;

View File

@ -469,7 +469,7 @@ invalid_option:
goto invalid_option; goto invalid_option;
} }
ctx = mem_alloc(sizeof(*ctx)); ctx = (struct add_option_to_tree_ctx *)mem_alloc(sizeof(*ctx));
if (!ctx) return EVENT_PROCESSED; if (!ctx) return EVENT_PROCESSED;
ctx->option = option; ctx->option = option;
ctx->widget_data = dlg_data->widgets_data; ctx->widget_data = dlg_data->widgets_data;
@ -759,7 +759,7 @@ struct kbdbind_add_hop {
static struct kbdbind_add_hop * static struct kbdbind_add_hop *
new_hop_from(struct kbdbind_add_hop *hop) new_hop_from(struct kbdbind_add_hop *hop)
{ {
struct kbdbind_add_hop *new_hop = mem_alloc(sizeof(*new_hop)); struct kbdbind_add_hop *new_hop = (struct kbdbind_add_hop *)mem_alloc(sizeof(*new_hop));
if (new_hop) if (new_hop)
copy_struct(new_hop, hop); copy_struct(new_hop, hop);

View File

@ -80,7 +80,7 @@ get_domain_tree(char *domain_name)
domain_len = strlen(domain_name); domain_len = strlen(domain_name);
/* One byte is reserved for domain in struct domain_tree. */ /* One byte is reserved for domain in struct domain_tree. */
domain = mem_alloc(sizeof(*domain) + domain_len); domain = (struct domain_tree *)mem_alloc(sizeof(*domain) + domain_len);
if (!domain) return NULL; if (!domain) return NULL;
domain->tree = copy_option(config_options, CO_SHALLOW domain->tree = copy_option(config_options, CO_SHALLOW

View File

@ -759,7 +759,7 @@ get_option_shadow(struct option *option, struct option *tree,
LIST_OF(struct option) * LIST_OF(struct option) *
init_options_tree(void) init_options_tree(void)
{ {
LIST_OF(struct option) *ptr = mem_alloc(sizeof(*ptr)); LIST_OF(struct option) *ptr = (LIST_OF(struct option) *)mem_alloc(sizeof(*ptr));
if (ptr) init_list(*ptr); if (ptr) init_list(*ptr);
return ptr; return ptr;
@ -1341,7 +1341,7 @@ register_options(union option_info info[], struct option *tree)
} }
break; break;
case OPT_STRING: case OPT_STRING:
string = mem_alloc(MAX_STR_LEN); string = (char *)mem_alloc(MAX_STR_LEN);
if (!string) { if (!string) {
delete_option(option); delete_option(option);
continue; continue;

View File

@ -370,7 +370,7 @@ extern struct option *add_opt(struct option *, char *, char *,
/*! @relates option */ /*! @relates option */
#define add_opt_str_tree(tree, path, capt, name, flags, def, desc) \ #define add_opt_str_tree(tree, path, capt, name, flags, def, desc) \
do { \ do { \
char *ptr = mem_alloc(MAX_STR_LEN); \ char *ptr = (char *)mem_alloc(MAX_STR_LEN); \
safe_strncpy(ptr, def, MAX_STR_LEN); \ safe_strncpy(ptr, def, MAX_STR_LEN); \
add_opt(tree, path, capt, name, flags, OPT_STRING, 0, MAX_STR_LEN, (longptr_T) ptr, DESC(desc)); \ add_opt(tree, path, capt, name, flags, OPT_STRING, 0, MAX_STR_LEN, (longptr_T) ptr, DESC(desc)); \
} while (0) } while (0)

View File

@ -202,7 +202,7 @@ static char *
num_rd(struct option *opt, char **file, int *line) num_rd(struct option *opt, char **file, int *line)
{ {
char *end = *file; char *end = *file;
long *value = mem_alloc(sizeof(*value)); long *value = (long *)mem_alloc(sizeof(*value));
if (!value) return NULL; if (!value) return NULL;
@ -347,7 +347,7 @@ str_wr(struct option *o, struct string *s)
static void static void
str_dup(struct option *opt, struct option *template_, int flags) str_dup(struct option *opt, struct option *template_, int flags)
{ {
char *new_ = mem_alloc(MAX_STR_LEN); char *new_ = (char *)mem_alloc(MAX_STR_LEN);
if (new_) safe_strncpy(new_, template_->value.string, MAX_STR_LEN); if (new_) safe_strncpy(new_, template_->value.string, MAX_STR_LEN);
opt->value.string = new_; opt->value.string = new_;

View File

@ -519,7 +519,7 @@ accept_cookie(struct cookie *cookie)
domain_len = strlen(cookie->domain); domain_len = strlen(cookie->domain);
/* One byte is reserved for domain in struct c_domain. */ /* One byte is reserved for domain in struct c_domain. */
cd = mem_alloc(sizeof(*cd) + domain_len); cd = (struct c_domain *)mem_alloc(sizeof(*cd) + domain_len);
if (!cd) return; if (!cd) return;
memcpy(cd->domain, cookie->domain, domain_len + 1); memcpy(cd->domain, cookie->domain, domain_len + 1);

View File

@ -286,7 +286,7 @@ cached_header_dialog(struct session *ses, struct cache_entry *cached)
title = N_("Internal header info"); title = N_("Internal header info");
#endif #endif
headers = mem_alloc(strlen(cached->head) + 1); headers = (char *)mem_alloc(strlen(cached->head) + 1);
if (!headers) return; if (!headers) return;
/* Sanitize headers string. */ /* Sanitize headers string. */

View File

@ -352,7 +352,7 @@ do_file_menu(struct terminal *term, void *xxx, void *ses_)
int anonymous = get_cmd_opt_bool("anonymous"); int anonymous = get_cmd_opt_bool("anonymous");
int x, o; int x, o;
file_menu = mem_alloc(sizeof(file_menu11) + sizeof(file_menu21) file_menu = (struct menu_item *)mem_alloc(sizeof(file_menu11) + sizeof(file_menu21)
+ sizeof(file_menu22) + sizeof(file_menu3) + sizeof(file_menu22) + sizeof(file_menu3)
+ 3 * sizeof(struct menu_item)); + 3 * sizeof(struct menu_item));
if (!file_menu) return; if (!file_menu) return;

View File

@ -129,7 +129,7 @@ copy_css_selector(struct css_stylesheet *css, struct css_selector *orig)
static void static void
add_selector_property(struct css_selector *selector, struct css_property *prop) add_selector_property(struct css_selector *selector, struct css_property *prop)
{ {
struct css_property *newprop = mem_alloc(sizeof(*newprop)); struct css_property *newprop = (struct css_property *)mem_alloc(sizeof(*newprop));
if (newprop) { if (newprop) {
copy_struct(newprop, prop); copy_struct(newprop, prop);

View File

@ -100,7 +100,7 @@ realloc_line(struct document *document, int x, int y)
static struct node * static struct node *
add_search_node(struct dom_renderer *renderer, int width) add_search_node(struct dom_renderer *renderer, int width)
{ {
struct node *node = mem_alloc(sizeof(*node)); struct node *node = (struct node *)mem_alloc(sizeof(*node));
if (node) { if (node) {
set_box(&node->box, renderer->canvas_x, renderer->canvas_y, set_box(&node->box, renderer->canvas_x, renderer->canvas_y,

View File

@ -350,7 +350,7 @@ distribute_rows_or_cols_that_left(int *val_, int max_value, int *values, int val
int divisor = 0; int divisor = 0;
int tmp_val; int tmp_val;
tmp_values = fmem_alloc(values_count * sizeof(*tmp_values)); tmp_values = (int *)fmem_alloc(values_count * sizeof(*tmp_values));
if (!tmp_values) return 0; if (!tmp_values) return 0;
memcpy(tmp_values, values, values_count * sizeof(*tmp_values)); memcpy(tmp_values, values, values_count * sizeof(*tmp_values));

View File

@ -572,7 +572,7 @@ look_for_link(char **pos, char *eof, struct menu_item **menu,
return 1; return 1;
} }
ld = mem_alloc(sizeof(*ld)); ld = (struct link_def *)mem_alloc(sizeof(*ld));
if (!ld) { if (!ld) {
mem_free_if(label); mem_free_if(label);
mem_free(target); mem_free(target);

View File

@ -125,7 +125,7 @@ truncate_label(char *label, int max_len)
if (left_part_len + right_part_len + 1 > max_len) if (left_part_len + right_part_len + 1 > max_len)
right_part_len--; right_part_len--;
new_label = mem_alloc(max_len + 1); new_label = (char *)mem_alloc(max_len + 1);
if (!new_label) return NULL; if (!new_label) return NULL;
if (left_part_len) if (left_part_len)

View File

@ -779,7 +779,7 @@ next_break:
dotcounter++; dotcounter++;
base_pos = ++html; base_pos = ++html;
if (*html >= ' ' || isspace(*html) || html >= eof) { if (*html >= ' ' || isspace(*html) || html >= eof) {
char *dots = fmem_alloc(dotcounter); char *dots = (char *)fmem_alloc(dotcounter);
if (dots) { if (dots) {
memset(dots, '.', dotcounter); memset(dots, '.', dotcounter);

View File

@ -154,7 +154,7 @@ html_stack_dup(struct html_context *html_context, enum html_element_mortality_ty
assertm(ep && (void *) ep != &html_context->stack, "html stack empty"); assertm(ep && (void *) ep != &html_context->stack, "html stack empty");
if_assert_failed return; if_assert_failed return;
e = mem_alloc(sizeof(*e)); e = (struct html_element *)mem_alloc(sizeof(*e));
if (!e) return; if (!e) return;
copy_struct(e, ep); copy_struct(e, ep);

View File

@ -981,7 +981,7 @@ shift_chars(struct html_context *html_context, int y, int shift)
len = LEN(y); len = LEN(y);
a = fmem_alloc(len * sizeof(*a)); a = (struct screen_char *)fmem_alloc(len * sizeof(*a));
if (!a) return; if (!a) return;
copy_screen_chars(a, &POS(0, y), len); copy_screen_chars(a, &POS(0, y), len);
@ -1240,13 +1240,13 @@ justify_line(struct html_context *html_context, int y)
assert(len > 0); assert(len > 0);
if_assert_failed return; if_assert_failed return;
line = fmem_alloc(len * sizeof(*line)); line = (struct screen_char *)fmem_alloc(len * sizeof(*line));
if (!line) return; if (!line) return;
/* It may sometimes happen that the line is only one char long and that /* It may sometimes happen that the line is only one char long and that
* char is space - then we're going to write to both [0] and [1], but * char is space - then we're going to write to both [0] and [1], but
* we allocated only one field. Thus, we've to do (len + 1). --pasky */ * we allocated only one field. Thus, we've to do (len + 1). --pasky */
space_list = fmem_alloc((len + 1) * sizeof(*space_list)); space_list = (int *)fmem_alloc((len + 1) * sizeof(*space_list));
if (!space_list) { if (!space_list) {
fmem_free(line); fmem_free(line);
return; return;
@ -1537,7 +1537,7 @@ html_special_tag(struct document *document, char *t, int x, int y)
tag_len = strlen(t); tag_len = strlen(t);
/* One byte is reserved for name in struct tag. */ /* One byte is reserved for name in struct tag. */
tag = mem_alloc(sizeof(*tag) + tag_len); tag = (struct tag *)mem_alloc(sizeof(*tag) + tag_len);
if (!tag) return; if (!tag) return;
tag->x = x; tag->x = x;
@ -2431,7 +2431,7 @@ format_html_part(struct html_context *html_context,
(char *) &key, (char *) &key,
sizeof(key)); sizeof(key));
if (item) { /* We found it in cache, so just copy and return. */ if (item) { /* We found it in cache, so just copy and return. */
part = mem_alloc(sizeof(*part)); part = (struct part *)mem_alloc(sizeof(*part));
if (part) { if (part) {
copy_struct(part, &((struct table_cache_entry *) copy_struct(part, &((struct table_cache_entry *)
item->value)->part); item->value)->part);
@ -2444,7 +2444,7 @@ format_html_part(struct html_context *html_context,
if_assert_failed return NULL; if_assert_failed return NULL;
if (document) { if (document) {
struct node *node = mem_alloc(sizeof(*node)); struct node *node = (struct node *)mem_alloc(sizeof(*node));
if (node) { if (node) {
int node_width = !html_context->table_level ? INT_MAX : width; int node_width = !html_context->table_level ? INT_MAX : width;

View File

@ -499,10 +499,10 @@ distribute_widths(struct table *table, int width)
memcpy(table->cols_widths, table->min_cols_widths, cols_array_size); memcpy(table->cols_widths, table->min_cols_widths, cols_array_size);
table->real_width = width; table->real_width = width;
widths = fmem_alloc(cols_array_size); widths = (int *)fmem_alloc(cols_array_size);
if (!widths) return; if (!widths) return;
max_widths = fmem_alloc(cols_array_size); max_widths = (int *)fmem_alloc(cols_array_size);
if (!max_widths) goto free_widths; if (!max_widths) goto free_widths;
while (spare_width) { while (spare_width) {
@ -1134,7 +1134,7 @@ draw_table_frames(struct table *table, int indent, int y,
int fh_size = (table->cols + 2) * (table->rows + 1); int fh_size = (table->cols + 2) * (table->rows + 1);
int fv_size = (table->cols + 1) * (table->rows + 2); int fv_size = (table->cols + 1) * (table->rows + 2);
frame[0] = fmem_alloc(fh_size + fv_size); frame[0] = (signed char *)fmem_alloc(fh_size + fv_size);
if (!frame[0]) return; if (!frame[0]) return;
memset(frame[0], -1, fh_size + fv_size); memset(frame[0], -1, fh_size + fv_size);
@ -1345,7 +1345,7 @@ format_table(char *attr, char *html, char *eof,
part->cy += table->real_height; part->cy += table->real_height;
part->cx = -1; part->cx = -1;
new_node = mem_alloc(sizeof(*new_node)); new_node = (struct node *)mem_alloc(sizeof(*new_node));
if (new_node) { if (new_node) {
set_box(&new_node->box, node->box.x, part->box.y + part->cy, set_box(&new_node->box, node->box.x, part->box.y + part->cy,
node->box.width, 0); node->box.width, 0);

View File

@ -717,7 +717,7 @@ init_template(struct screen_char *template_, struct document_options *options)
static struct node * static struct node *
add_node(struct plain_renderer *renderer, int x, int width, int height) add_node(struct plain_renderer *renderer, int x, int width, int height)
{ {
struct node *node = mem_alloc(sizeof(*node)); struct node *node = (struct node *)mem_alloc(sizeof(*node));
if (node) { if (node) {
struct document *document = renderer->document; struct document *document = renderer->document;

View File

@ -31,7 +31,7 @@ init_document_refresh(char *url, unsigned long seconds)
{ {
struct document_refresh *refresh; struct document_refresh *refresh;
refresh = mem_alloc(sizeof(*refresh)); refresh = (struct document_refresh *)mem_alloc(sizeof(*refresh));
if (!refresh) return NULL; if (!refresh) return NULL;
refresh->uri = get_uri(url, URI_NONE); refresh->uri = get_uri(url, URI_NONE);

View File

@ -164,7 +164,7 @@ next_break:
dotcounter++; dotcounter++;
base_pos = ++html; base_pos = ++html;
if (*html >= ' ' || isspace(*html) || html >= eof) { if (*html >= ' ' || isspace(*html) || html >= eof) {
char *dots = fmem_alloc(dotcounter); char *dots = (char *)fmem_alloc(dotcounter);
if (dots) { if (dots) {
memset(dots, '.', dotcounter); memset(dots, '.', dotcounter);

View File

@ -919,7 +919,7 @@ tags_format_table(struct source_renderer *renderer, void *no)
part->cy += table->real_height; part->cy += table->real_height;
part->cx = -1; part->cx = -1;
new_node = mem_alloc(sizeof(*new_node)); new_node = (struct node *)mem_alloc(sizeof(*new_node));
if (new_node) { if (new_node) {
set_box(&new_node->box, node->box.x, part->box.y + part->cy, set_box(&new_node->box, node->box.x, part->box.y + part->cy,
node->box.width, 0); node->box.width, 0);

View File

@ -1699,7 +1699,7 @@ truncate_label(unsigned char *label, int max_len)
if (left_part_len + right_part_len + 1 > max_len) if (left_part_len + right_part_len + 1 > max_len)
right_part_len--; right_part_len--;
new_label = mem_alloc(max_len + 1); new_label = (unsigned char *)mem_alloc(max_len + 1);
if (!new_label) return NULL; if (!new_label) return NULL;
if (left_part_len) if (left_part_len)

View File

@ -318,7 +318,7 @@ main(int argc, char *argv[])
if (read_stdin > 0) { if (read_stdin > 0) {
char *buffer; char *buffer;
buffer = mem_alloc(read_stdin); buffer = (char *)mem_alloc(read_stdin);
if (!buffer) if (!buffer)
die("Cannot allocate buffer"); die("Cannot allocate buffer");

View File

@ -83,7 +83,7 @@ add_heartbeat(struct ecmascript_interpreter *interpreter)
ses = NULL; ses = NULL;
else else
ses = interpreter->vs->doc_view->session; ses = interpreter->vs->doc_view->session;
hb = mem_alloc(sizeof(struct heartbeat)); hb = (struct heartbeat *)mem_alloc(sizeof(struct heartbeat));
if (!hb) return NULL; if (!hb) return NULL;

View File

@ -93,7 +93,7 @@ add_heartbeat(struct ecmascript_interpreter *interpreter)
ses = NULL; ses = NULL;
else else
ses = interpreter->vs->doc_view->session; ses = interpreter->vs->doc_view->session;
hb = mem_alloc(sizeof(struct heartbeat)); hb = (struct heartbeat *)mem_alloc(sizeof(struct heartbeat));
if (!hb) return NULL; if (!hb) return NULL;

View File

@ -54,7 +54,7 @@ bzip2_open(struct stream_encoded *stream, int fd)
* pointer.) */ * pointer.) */
static const bz_stream null_bz_stream = {0}; static const bz_stream null_bz_stream = {0};
struct bz2_enc_data *data = mem_alloc(sizeof(*data)); struct bz2_enc_data *data = (struct bz2_enc_data *)mem_alloc(sizeof(*data));
int err; int err;
stream->data = NULL; stream->data = NULL;

View File

@ -110,7 +110,7 @@ open_encoded(int fd, enum stream_encoding encoding)
{ {
struct stream_encoded *stream; struct stream_encoded *stream;
stream = mem_alloc(sizeof(*stream)); stream = (struct stream_encoded *)mem_alloc(sizeof(*stream));
if (!stream) return NULL; if (!stream) return NULL;
stream->encoding = encoding; stream->encoding = encoding;

View File

@ -47,7 +47,7 @@ deflate_open(int window_size, struct stream_encoded *stream, int fd)
static const z_stream null_z_stream = {0}; static const z_stream null_z_stream = {0};
int err; int err;
struct deflate_enc_data *data = mem_alloc(sizeof(*data)); struct deflate_enc_data *data = (struct deflate_enc_data *)mem_alloc(sizeof(*data));
stream->data = NULL; stream->data = NULL;
if (!data) { if (!data) {

View File

@ -35,7 +35,7 @@ struct lzma_enc_data {
static int static int
lzma_open(struct stream_encoded *stream, int fd) lzma_open(struct stream_encoded *stream, int fd)
{ {
struct lzma_enc_data *data = mem_alloc(sizeof(*data)); struct lzma_enc_data *data = (struct lzma_enc_data *)mem_alloc(sizeof(*data));
int err; int err;
stream->data = NULL; stream->data = NULL;

View File

@ -54,7 +54,7 @@ new_formhist_item(char *url)
if (!form) return NULL; if (!form) return NULL;
memcpy(form->url, url, url_len); memcpy(form->url, url, url_len);
form->submit = mem_alloc(sizeof(*form->submit)); form->submit = (LIST_OF(struct submitted_value) *)mem_alloc(sizeof(*form->submit));
if (!form->submit) { mem_free(form); return NULL; } if (!form->submit) { mem_free(form); return NULL; }
object_nolock(form, "formhist"); object_nolock(form, "formhist");

View File

@ -814,7 +814,7 @@ get_combined(unicode_val_T *data, int length)
if (item) return (unicode_val_T)(long)item->value; if (item) return (unicode_val_T)(long)item->value;
if (last_combined >= UCS_END_COMBINED) return UCS_NO_CHAR; if (last_combined >= UCS_END_COMBINED) return UCS_NO_CHAR;
key = mem_alloc((length + 1) * sizeof(*key)); key = (unicode_val_T *)mem_alloc((length + 1) * sizeof(*key));
if (!key) return UCS_NO_CHAR; if (!key) return UCS_NO_CHAR;
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
key[i] = data[i]; key[i] = data[i];
@ -1314,7 +1314,7 @@ convert_string(struct conv_table *convert_table,
/* Buffer allocation */ /* Buffer allocation */
buffer = mem_alloc(ALLOC_GR + 1 /* trailing \0 */); buffer = (char *)mem_alloc(ALLOC_GR + 1 /* trailing \0 */);
if (!buffer) return NULL; if (!buffer) return NULL;
#ifdef HAVE_ICONV #ifdef HAVE_ICONV

View File

@ -154,7 +154,7 @@ register_bottom_half_do(select_handler_T fn, void *data)
if (bh->fn == fn && bh->data == data) if (bh->fn == fn && bh->data == data)
return 0; return 0;
bh = mem_alloc(sizeof(*bh)); bh = (struct bottom_half *)mem_alloc(sizeof(*bh));
if (!bh) return -1; if (!bh) return -1;
bh->fn = fn; bh->fn = fn;
bh->data = data; bh->data = data;
@ -255,7 +255,7 @@ set_event_for_action(int h, void (*func)(void *), struct event **evptr, short ev
#ifdef EV_PERSIST #ifdef EV_PERSIST
evtype |= EV_PERSIST; evtype |= EV_PERSIST;
#endif #endif
*evptr = mem_alloc(sizeof_struct_event); *evptr = (struct event *)mem_alloc(sizeof_struct_event);
event_set(*evptr, h, evtype, event_callback, *evptr); event_set(*evptr, h, evtype, event_callback, *evptr);
#ifdef HAVE_EVENT_BASE_SET #ifdef HAVE_EVENT_BASE_SET
if (event_base_set(event_base, *evptr) == -1) if (event_base_set(event_base, *evptr) == -1)

View File

@ -167,10 +167,10 @@ install_timer(timer_id_T *id, milliseconds_T delay, void (*func)(void *), void *
assert(id && delay > 0); assert(id && delay > 0);
#ifdef USE_LIBEVENT #ifdef USE_LIBEVENT
char *q = mem_alloc(sizeof_struct_event + sizeof(struct timer)); char *q = (char *)mem_alloc(sizeof_struct_event + sizeof(struct timer));
new_timer = (struct timer *)(q + sizeof_struct_event); new_timer = (struct timer *)(q + sizeof_struct_event);
#else #else
new_timer = mem_alloc(sizeof(*new_timer)); new_timer = (struct timer *)mem_alloc(sizeof(*new_timer));
#endif #endif
*id = (timer_id_T) new_timer; /* TIMER_ID_UNDEF is NULL */ *id = (timer_id_T) new_timer; /* TIMER_ID_UNDEF is NULL */
if (!new_timer) return; if (!new_timer) return;

View File

@ -172,7 +172,7 @@ add_mailcap_entry(struct mailcap_entry *entry, char *type, int typelen)
/* First check if the type is already checked in */ /* First check if the type is already checked in */
item = get_hash_item(mailcap_map, type, typelen); item = get_hash_item(mailcap_map, type, typelen);
if (!item) { if (!item) {
mitem = mem_alloc(sizeof(*mitem) + typelen); mitem = (struct mailcap_hash_item *)mem_alloc(sizeof(*mitem) + typelen);
if (!mitem) { if (!mitem) {
done_mailcap_entry(entry); done_mailcap_entry(entry);
return; return;

View File

@ -110,7 +110,7 @@ add_to_dns_cache(char *name, struct sockaddr_storage *addr, int addrno)
if (!dnsentry) return; if (!dnsentry) return;
size = addrno * sizeof(*dnsentry->addr); size = addrno * sizeof(*dnsentry->addr);
dnsentry->addr = mem_alloc(size); dnsentry->addr = (struct sockaddr_storage *)mem_alloc(size);
if (!dnsentry->addr) { if (!dnsentry->addr) {
mem_free(dnsentry); mem_free(dnsentry);
return; return;

View File

@ -234,7 +234,7 @@ dns_found(struct socket *socket, struct sockaddr_storage *addr, int addrlen)
size = sizeof(*addr) * addrlen; size = sizeof(*addr) * addrlen;
connect_info->addr = mem_alloc(size); connect_info->addr = (struct sockaddr_storage *)mem_alloc(size);
if (!connect_info->addr) { if (!connect_info->addr) {
socket->ops->done(socket, connection_state(S_OUT_OF_MEM)); socket->ops->done(socket, connection_state(S_OUT_OF_MEM));
return; return;
@ -894,7 +894,7 @@ write_to_socket(struct socket *socket, char *data, int len,
socket->ops->set_timeout(socket, connection_state(0)); socket->ops->set_timeout(socket, connection_state(0));
wb = mem_alloc(sizeof(*wb) + len); wb = (struct write_buffer *)mem_alloc(sizeof(*wb) + len);
if (!wb) { if (!wb) {
socket->ops->done(socket, connection_state(S_OUT_OF_MEM)); socket->ops->done(socket, connection_state(S_OUT_OF_MEM));
return; return;

View File

@ -377,7 +377,7 @@ init_ssl_connection(struct socket *socket,
} }
#elif defined(CONFIG_GNUTLS) #elif defined(CONFIG_GNUTLS)
ssl_t *state = mem_alloc(sizeof(ssl_t)); ssl_t *state = (ssl_t *)mem_alloc(sizeof(ssl_t));
if (!state) return S_SSL_ERROR; if (!state) return S_SSL_ERROR;

View File

@ -283,7 +283,7 @@ get_window_title(int codepage)
if (hab != NULLHANDLE) { if (hab != NULLHANDLE) {
hmq = WinCreateMsgQueue(hab, 0); hmq = WinCreateMsgQueue(hab, 0);
if (hmq != NULLHANDLE) { if (hmq != NULLHANDLE) {
org_win_title = mem_alloc(MAXNAMEL + 1); org_win_title = (char *)mem_alloc(MAXNAMEL + 1);
if (org_win_title) if (org_win_title)
WinQueryWindowText(swData.hwnd, WinQueryWindowText(swData.hwnd,
MAXNAMEL + 1, MAXNAMEL + 1,
@ -367,13 +367,13 @@ set_window_title(int init, const char *url)
memset(&swData, 0, sizeof(swData)); memset(&swData, 0, sizeof(swData));
hSw = WinQuerySwitchHandle(0, pib->pib_ulpid); hSw = WinQuerySwitchHandle(0, pib->pib_ulpid);
if (hSw != NULLHANDLE && !WinQuerySwitchEntry(hSw, &swData)) { if (hSw != NULLHANDLE && !WinQuerySwitchEntry(hSw, &swData)) {
org_switch_title = mem_alloc(strlen(swData.szSwtitle) + 1); org_switch_title = (char *)mem_alloc(strlen(swData.szSwtitle) + 1);
strcpy(org_switch_title, swData.szSwtitle); strcpy(org_switch_title, swData.szSwtitle);
pib->pib_ultype = 3; pib->pib_ultype = 3;
hab = WinInitialize(0); hab = WinInitialize(0);
hmq = WinCreateMsgQueue(hab, 0); hmq = WinCreateMsgQueue(hab, 0);
if (hab != NULLHANDLE && hmq != NULLHANDLE) { if (hab != NULLHANDLE && hmq != NULLHANDLE) {
org_win_title = mem_alloc(MAXNAMEL + 1); org_win_title = (char *)mem_alloc(MAXNAMEL + 1);
WinQueryWindowText(swData.hwnd, MAXNAMEL + 1, org_win_title); WinQueryWindowText(swData.hwnd, MAXNAMEL + 1, org_win_title);
WinDestroyMsgQueue(hmq); WinDestroyMsgQueue(hmq);
WinTerminate(hab); WinTerminate(hab);

View File

@ -145,7 +145,7 @@ get_cwd(void)
char *buf; char *buf;
while (1) { while (1) {
buf = mem_alloc(bufsize); buf = (char *)mem_alloc(bufsize);
if (!buf) return NULL; if (!buf) return NULL;
if (getcwd(buf, bufsize)) return buf; if (getcwd(buf, bufsize)) return buf;
mem_free(buf); mem_free(buf);

View File

@ -107,7 +107,7 @@ handle_mouse(int cons, void (*fn)(void *, char *, int),
h = init_mouse(cons, 0); h = init_mouse(cons, 0);
if (h < 0) return NULL; if (h < 0) return NULL;
gms = mem_alloc(sizeof(*gms)); gms = (struct gpm_mouse_spec *)mem_alloc(sizeof(*gms));
if (!gms) return NULL; if (!gms) return NULL;
gms->h = h; gms->h = h;
gms->cons = cons; gms->cons = cons;

View File

@ -285,7 +285,7 @@ add_bittorrent_peer_request(struct bittorrent_peer_status *status,
request = get_bittorrent_peer_request(status, piece, offset, length); request = get_bittorrent_peer_request(status, piece, offset, length);
if (request) return; if (request) return;
request = mem_alloc(sizeof(*request)); request = (struct bittorrent_peer_request *)mem_alloc(sizeof(*request));
if (!request) return; if (!request) return;
request->piece = piece; request->piece = piece;

View File

@ -402,7 +402,7 @@ send_bittorrent_peer_message(struct bittorrent_peer_connection *peer,
va_end(args); va_end(args);
message = mem_alloc(sizeof(*message)); message = (struct bittorrent_peer_request *)mem_alloc(sizeof(*message));
if (!message) return; if (!message) return;
memcpy(message, &message_store, sizeof(*message)); memcpy(message, &message_store, sizeof(*message));

View File

@ -324,7 +324,7 @@ clone_bittorrent_peer_request(struct bittorrent_peer_request *request)
{ {
struct bittorrent_peer_request *clone; struct bittorrent_peer_request *clone;
clone = mem_alloc(sizeof(*clone)); clone = (struct bittorrent_peer_request *)mem_alloc(sizeof(*clone));
if (!clone) return NULL; if (!clone) return NULL;
/* Both are now clones ... */ /* Both are now clones ... */

View File

@ -333,7 +333,7 @@ again:
while (start < e && *(e - 1) == ' ') e--; while (start < e && *(e - 1) == ' ') e--;
if (start == e) return NULL; if (start == e) return NULL;
n = mem_alloc(e - start + 1); n = (char *)mem_alloc(e - start + 1);
if (n) { if (n) {
int i = 0; int i = 0;

View File

@ -53,7 +53,7 @@ add_blacklist_entry(struct uri *uri, enum blacklist_flags flags)
return; return;
} }
entry = mem_alloc(sizeof(*entry) + uri->hostlen); entry = (struct blacklist_entry *)mem_alloc(sizeof(*entry) + uri->hostlen);
if (!entry) return; if (!entry) return;
entry->flags = flags; entry->flags = flags;

View File

@ -1000,7 +1000,7 @@ join_urls(struct uri *base, char *rel)
} }
length = path - struri(base); length = path - struri(base);
uristring = mem_alloc(length + strlen(rel) + add_slash + 1); uristring = (char *)mem_alloc(length + strlen(rel) + add_slash + 1);
if (!uristring) return NULL; if (!uristring) return NULL;
memcpy(uristring, struri(base), length); memcpy(uristring, struri(base), length);

View File

@ -202,7 +202,7 @@ python_input_box(PyObject *self, PyObject *args, PyObject *kwargs)
if (!initial) goto free_title; if (!initial) goto free_title;
} }
hop = mem_alloc(sizeof(*hop)); hop = (struct python_input_callback_hop *)mem_alloc(sizeof(*hop));
if (!hop) goto free_initial; if (!hop) goto free_initial;
hop->ses = python_ses; hop->ses = python_ses;
hop->callback = callback; hop->callback = callback;

View File

@ -122,10 +122,10 @@ python_load(PyObject *self, PyObject *args)
return NULL; return NULL;
} }
download = mem_alloc(sizeof(*download)); download = (struct download *)mem_alloc(sizeof(*download));
if (!download) goto mem_error; if (!download) goto mem_error;
hop = mem_alloc(sizeof(*hop)); hop = (struct python_load_uri_callback_hop *)mem_alloc(sizeof(*hop));
if (!hop) goto free_download; if (!hop) goto free_download;
hop->ses = python_ses; hop->ses = python_ses;
hop->callback = callback; hop->callback = callback;

View File

@ -138,7 +138,7 @@ smjs_get_action_fn_object(char *action_str)
obj = JS_NewObject(smjs_ctx, (JSClass *) &action_fn_class); obj = JS_NewObject(smjs_ctx, (JSClass *) &action_fn_class);
if (!obj) return NULL; if (!obj) return NULL;
hop = mem_alloc(sizeof(*hop)); hop = (struct smjs_action_fn_callback_hop *)mem_alloc(sizeof(*hop));
if (!hop) return NULL; if (!hop) return NULL;
hop->ses = smjs_ses; hop->ses = smjs_ses;

View File

@ -96,13 +96,13 @@ smjs_load_uri(JSContext *ctx, unsigned int argc, JS::Value *rval)
return false; return false;
} }
download = mem_alloc(sizeof(*download)); download = (struct download *)mem_alloc(sizeof(*download));
if (!download) { if (!download) {
done_uri(uri); done_uri(uri);
return false; return false;
} }
hop = mem_alloc(sizeof(*hop)); hop = (struct smjs_load_uri_hop *)mem_alloc(sizeof(*hop));
if (!hop) { if (!hop) {
mem_free(download); mem_free(download);
done_uri(uri); done_uri(uri);

View File

@ -609,7 +609,7 @@ check_questions_queue(struct session *ses)
void void
add_questions_entry(void (*callback)(struct session *, void *), void *data) add_questions_entry(void (*callback)(struct session *, void *), void *data)
{ {
struct questions_entry *q = mem_alloc(sizeof(*q)); struct questions_entry *q = (struct questions_entry *)mem_alloc(sizeof(*q));
if (!q) return; if (!q) return;

View File

@ -238,7 +238,7 @@ ses_goto(struct session *ses, struct uri *uri, char *target_frame,
return; return;
} }
task = mem_alloc(sizeof(*task)); task = (struct task *)mem_alloc(sizeof(*task));
if (!task) return; if (!task) return;
task->ses = ses; task->ses = ses;

View File

@ -653,7 +653,7 @@ has_nul_byte:
del_len = delete_.length; del_len = delete_.length;
param_len = path_len + del_len + 3; param_len = path_len + del_len + 3;
param = mem_alloc(param_len); param = (char *)mem_alloc(param_len);
if (!param) goto nasty_thing; if (!param) goto nasty_thing;
param[0] = fg; param[0] = fg;

View File

@ -595,7 +595,7 @@ add_screen_driver(enum term_mode_type type, struct terminal *term, int env_len)
struct screen_driver *driver; struct screen_driver *driver;
/* One byte is reserved for name in struct screen_driver. */ /* One byte is reserved for name in struct screen_driver. */
driver = mem_alloc(sizeof(*driver) + env_len); driver = (struct screen_driver *)mem_alloc(sizeof(*driver) + env_len);
if (!driver) return NULL; if (!driver) return NULL;
/* These four operations fully initialize *driver. */ /* These four operations fully initialize *driver. */

View File

@ -283,7 +283,7 @@ exec_on_master_terminal(struct terminal *term,
{ {
int blockh; int blockh;
int param_size = plen + dlen + 2 /* 2 null char */ + 1 /* fg */; int param_size = plen + dlen + 2 /* 2 null char */ + 1 /* fg */;
char *param = fmem_alloc(param_size); char *param = (char *)fmem_alloc(param_size);
if (!param) return; if (!param) return;
@ -325,7 +325,7 @@ exec_on_slave_terminal( struct terminal *term,
enum term_exec fg) enum term_exec fg)
{ {
int data_size = plen + dlen + 1 /* 0 */ + 1 /* fg */ + 2 /* 2 null char */; int data_size = plen + dlen + 1 /* 0 */ + 1 /* fg */ + 2 /* 2 null char */;
char *data = fmem_alloc(data_size); char *data = (char *)fmem_alloc(data_size);
if (!data) return; if (!data) return;
@ -395,7 +395,7 @@ do_terminal_function(struct terminal *term, unsigned char code,
char *data) char *data)
{ {
int data_len = strlen(data); int data_len = strlen(data);
char *x_data = fmem_alloc(data_len + 1 /* code */ + 1 /* null char */); char *x_data = (char *)fmem_alloc(data_len + 1 /* code */ + 1 /* null char */);
if (!x_data) return; if (!x_data) return;
x_data[0] = code; x_data[0] = code;

View File

@ -165,7 +165,7 @@ empty_window_handler(struct window *win, struct term_event *ev)
void void
add_empty_window(struct terminal *term, void (*fn)(void *), void *data) add_empty_window(struct terminal *term, void (*fn)(void *), void *data)
{ {
struct ewd *ewd = mem_alloc(sizeof(*ewd)); struct ewd *ewd = (struct ewd *)mem_alloc(sizeof(*ewd));
if (!ewd) return; if (!ewd) return;
ewd->fn = fn; ewd->fn = fn;

View File

@ -33,7 +33,7 @@ base64_encode_bin(char *in, int inlen, int *outlen)
assert(in && *in); assert(in && *in);
if_assert_failed return NULL; if_assert_failed return NULL;
out = outstr = mem_alloc((inlen / 3) * 4 + 4 + 1); out = outstr = (char *)mem_alloc((inlen / 3) * 4 + 4 + 1);
if (!out) return NULL; if (!out) return NULL;
while (inlen >= 3) { while (inlen >= 3) {
@ -93,7 +93,7 @@ base64_decode_bin(char *in, int inlen, int *outlen)
assert(in && *in); assert(in && *in);
if_assert_failed return NULL; if_assert_failed return NULL;
outstr = out = mem_alloc(inlen / 4 * 3 + 1); outstr = out = (char *)mem_alloc(inlen / 4 * 3 + 1);
if (!outstr) return NULL; if (!outstr) return NULL;
if (!once) { if (!once) {

View File

@ -386,7 +386,7 @@ static inline void
compress_node(struct ff_node *leafset, struct fastfind_info *info, compress_node(struct ff_node *leafset, struct fastfind_info *info,
int i, int pos) int i, int pos)
{ {
struct ff_node_c *new_ = mem_alloc(sizeof(*new_)); struct ff_node_c *new_ = (struct ff_node_c *)mem_alloc(sizeof(*new_));
if (!new_) return; if (!new_) return;

View File

@ -154,7 +154,7 @@ get_unique_name(char *fileprefix)
digits++; digits++;
if (file != fileprefix) mem_free(file); if (file != fileprefix) mem_free(file);
file = mem_alloc(fileprefixlen + 2 + digits); file = (char *)mem_alloc(fileprefixlen + 2 + digits);
if (!file) return NULL; if (!file) return NULL;
memcpy(file, fileprefix, fileprefixlen); memcpy(file, fileprefix, fileprefixlen);
@ -187,7 +187,7 @@ file_read_line(char *line, size_t *size, FILE *file, int *lineno)
size_t offset = 0; size_t offset = 0;
if (!line) { if (!line) {
line = mem_alloc(MAX_STR_LEN); line = (char *)mem_alloc(MAX_STR_LEN);
if (!line) if (!line)
return NULL; return NULL;
@ -395,7 +395,7 @@ mkalldirs(const char *path)
/* Make a copy of path, to be able to write to it. Otherwise, the /* Make a copy of path, to be able to write to it. Otherwise, the
* function is unsafe if called with a read-only char *argument. */ * function is unsafe if called with a read-only char *argument. */
len = strlen(path) + 1; len = strlen(path) + 1;
p = fmem_alloc(len); p = (char *)fmem_alloc(len);
if (!p) return -1; if (!p) return -1;
memcpy(p, path, len); memcpy(p, path, len);

View File

@ -37,7 +37,7 @@ init_hash(unsigned int width, hash_func_T func)
if_assert_failed return NULL; if_assert_failed return NULL;
/* One is already reserved in struct hash, so use size - 1. */ /* One is already reserved in struct hash, so use size - 1. */
hash = mem_alloc(sizeof(*hash) + (hash_size(width) - 1) hash = (struct hash *)mem_alloc(sizeof(*hash) + (hash_size(width) - 1)
* sizeof(struct list_head)); * sizeof(struct list_head));
if (!hash) return NULL; if (!hash) return NULL;
@ -86,7 +86,7 @@ add_hash_item(struct hash *hash, const char *key, unsigned int keylen,
void *value) void *value)
{ {
hash_value_T hashval; hash_value_T hashval;
struct hash_item *item = mem_alloc(sizeof(*item)); struct hash_item *item = (struct hash_item *)mem_alloc(sizeof(*item));
if (!item) return NULL; if (!item) return NULL;

View File

@ -52,7 +52,7 @@ getml(void *p, ...)
va_end(ap); va_end(ap);
/* Allocate space for memory list. */ /* Allocate space for memory list. */
ml = mem_alloc(ML_SIZE(n)); ml = (struct memory_list *)mem_alloc(ML_SIZE(n));
if (!ml) return NULL; if (!ml) return NULL;
/* First element. */ /* First element. */
@ -106,7 +106,7 @@ add_to_ml(struct memory_list **ml, ...)
if (!*ml) { if (!*ml) {
/* If getml() wasn't called before or returned NULL, /* If getml() wasn't called before or returned NULL,
* then we create it. */ * then we create it. */
*ml = mem_alloc(ML_SIZE(n)); *ml = (struct memory_list *)mem_alloc(ML_SIZE(n));
if (!*ml) return; if (!*ml) return;
(*ml)->n = 0; (*ml)->n = 0;
@ -147,7 +147,7 @@ add_one_to_ml(struct memory_list **ml, void *p)
if (!*ml) { if (!*ml) {
/* If getml() wasn't called before or returned NULL, /* If getml() wasn't called before or returned NULL,
* then we create it. */ * then we create it. */
*ml = mem_alloc(ML_SIZE(1)); *ml = (struct memory_list *)mem_alloc(ML_SIZE(1));
if (!*ml) return; if (!*ml) return;
(*ml)->n = 0; (*ml)->n = 0;

View File

@ -128,9 +128,9 @@ mem_align_alloc__(
oldsize *= objsize; oldsize *= objsize;
#ifdef DEBUG_MEMLEAK #ifdef DEBUG_MEMLEAK
data = debug_mem_realloc(file, line, *ptr, newsize); data = (char *)debug_mem_realloc(file, line, *ptr, newsize);
#else #else
data = mem_realloc(*ptr, newsize); data = (char *)mem_realloc(*ptr, newsize);
#endif #endif
if (!data) return NULL; if (!data) return NULL;
@ -185,9 +185,9 @@ intdup__(
int i) int i)
{ {
#ifdef DEBUG_MEMLEAK #ifdef DEBUG_MEMLEAK
int *p = debug_mem_alloc(file, line, sizeof(*p)); int *p = (int *)debug_mem_alloc(file, line, sizeof(*p));
#else #else
int *p = mem_alloc(sizeof(*p)); int *p = (int *)mem_alloc(sizeof(*p));
#endif #endif
if (p) *p = i; if (p) *p = i;

View File

@ -91,7 +91,7 @@ vasprintfa(const char *fmt, va_list ap) {
return NULL; return NULL;
size = strlen(str1) + 1; size = strlen(str1) + 1;
str2 = mem_alloc(size); str2 = (char *)mem_alloc(size);
if (str2) memcpy(str2, str1, size); if (str2) memcpy(str2, str1, size);
free(str1); free(str1);

View File

@ -49,7 +49,7 @@ debug_memacpy(const char *f, int l, const char *src, int len)
string_assert(f, l, len >= 0, "memacpy"); string_assert(f, l, len >= 0, "memacpy");
if_assert_failed len = 0; if_assert_failed len = 0;
m = debug_mem_alloc(f, l, len + 1); m = (char *)debug_mem_alloc(f, l, len + 1);
if (!m) return NULL; if (!m) return NULL;
if (src && len) memcpy(m, src, len); if (src && len) memcpy(m, src, len);
@ -77,7 +77,7 @@ memacpy(const char *src, int len)
assertm(len >= 0, "[memacpy]"); assertm(len >= 0, "[memacpy]");
if_assert_failed { len = 0; } if_assert_failed { len = 0; }
m = mem_alloc(len + 1); m = (char *)mem_alloc(len + 1);
if (!m) return NULL; if (!m) return NULL;
if (src && len) memcpy(m, src, len); if (src && len) memcpy(m, src, len);
@ -145,7 +145,7 @@ straconcat(const char *str, ...)
if_assert_failed { return NULL; } if_assert_failed { return NULL; }
len = strlen(str); len = strlen(str);
s = mem_alloc(len + 1); s = (char *)mem_alloc(len + 1);
if (!s) return NULL; if (!s) return NULL;
if (len) memcpy(s, str, len); if (len) memcpy(s, str, len);
@ -330,9 +330,9 @@ init_string(struct string *string)
string->length = 0; string->length = 0;
#ifdef DEBUG_MEMLEAK #ifdef DEBUG_MEMLEAK
string->source = debug_mem_alloc(file, line, STRING_GRANULARITY + 1); string->source = (char *)debug_mem_alloc(file, line, STRING_GRANULARITY + 1);
#else #else
string->source = mem_alloc(STRING_GRANULARITY + 1); string->source = (char *)mem_alloc(STRING_GRANULARITY + 1);
#endif #endif
if (!string->source) return NULL; if (!string->source) return NULL;
@ -622,7 +622,7 @@ add_to_string_list(LIST_OF(struct string_list_item) *list,
assertm(list && source, "[add_to_string_list]"); assertm(list && source, "[add_to_string_list]");
if_assert_failed return NULL; if_assert_failed return NULL;
item = mem_alloc(sizeof(*item)); item = (struct string_list_item *)mem_alloc(sizeof(*item));
if (!item) return NULL; if (!item) return NULL;
string = &item->string; string = &item->string;

View File

@ -173,7 +173,7 @@ dump_output_alloc(int fd, struct string *string, int cp)
assert((fd == -1) ^ (string == NULL)); assert((fd == -1) ^ (string == NULL));
if_assert_failed return NULL; if_assert_failed return NULL;
out = mem_alloc(sizeof(*out)); out = (struct dump_output *)mem_alloc(sizeof(*out));
if (out) { if (out) {
out->fd = fd; out->fd = fd;
out->string = string; out->string = string;

View File

@ -79,7 +79,7 @@ init_submitted_value(char *name, char *value, enum form_type type,
{ {
struct submitted_value *sv; struct submitted_value *sv;
sv = mem_alloc(sizeof(*sv)); sv = (struct submitted_value *)mem_alloc(sizeof(*sv));
if (!sv) return NULL; if (!sv) return NULL;
sv->value = stracpy(value); sv->value = stracpy(value);

View File

@ -219,7 +219,7 @@ get_search_data(struct document *document)
document->nsearch = 0; document->nsearch = 0;
document->search = mem_alloc(n * sizeof(*document->search)); document->search = (struct search *)mem_alloc(n * sizeof(*document->search));
if (!document->search) return; if (!document->search) return;
get_srch(document); get_srch(document);
@ -296,7 +296,7 @@ get_search_region_from_search_nodes(struct search *s1, struct search *s2,
*doclen = s2 - s1 + pattern_len; *doclen = s2 - s1 + pattern_len;
if (!*doclen) return NULL; if (!*doclen) return NULL;
doc = mem_alloc((*doclen + 1) * sizeof(UCHAR)); doc = (UCHAR *)mem_alloc((*doclen + 1) * sizeof(UCHAR));
if (!doc) { if (!doc) {
*doclen = -1; *doclen = -1;
return NULL; return NULL;
@ -483,7 +483,7 @@ static UCHAR *
memacpy_u(char *text, int textlen, int utf8) memacpy_u(char *text, int textlen, int utf8)
{ {
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
UCHAR *mem = mem_alloc((textlen + 1) * sizeof(UCHAR)); UCHAR *mem = (UCHAR *)mem_alloc((textlen + 1) * sizeof(UCHAR));
if (!mem) return NULL; if (!mem) return NULL;
if (utf8) { if (utf8) {

View File

@ -120,7 +120,7 @@ copy_vs(struct view_state *dst, struct view_state *src)
} }
if (src->form_info_len) { if (src->form_info_len) {
dst->form_info = mem_alloc(src->form_info_len dst->form_info = (struct form_state *)mem_alloc(src->form_info_len
* sizeof(*src->form_info)); * sizeof(*src->form_info));
if (dst->form_info) { if (dst->form_info) {
int i; int i;