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

mem_alloc_align: drop the obj type parameter

Instead use the object itself, i.e., replace typeof(obj) with
typeof(**ptr).
This commit is contained in:
Miciah Dashiel Butler Masters 2006-02-17 17:32:59 +00:00 committed by Miciah Dashiel Butler Masters
parent e6b9093f87
commit 190259ca22
15 changed files with 21 additions and 24 deletions

View File

@ -1146,7 +1146,7 @@ mainmenu_handler(struct window *win, struct term_event *ev)
/* For dynamic menus the last (cleared) item is used to mark the end. */
#define realloc_menu_items(mi_, size) \
mem_align_alloc(mi_, size, (size) + 2, struct menu_item, 0xF)
mem_align_alloc(mi_, size, (size) + 2, 0xF)
struct menu_item *
new_menu(enum menu_item_flags flags)

View File

@ -83,7 +83,7 @@ split_line(unsigned char *text, int max_width)
#undef is_unsplitable
#define LINES_GRANULARITY 0x7
#define realloc_lines(x, o, n) mem_align_alloc(x, o, n, unsigned char *, LINES_GRANULARITY)
#define realloc_lines(x, o, n) mem_align_alloc(x, o, n, LINES_GRANULARITY)
/* Find the start of each line with the current max width */
static unsigned char **

View File

@ -8,12 +8,12 @@
#define LINE_GRANULARITY 0x0F
#define LINK_GRANULARITY 0x7F
#define ALIGN_LINES(x, o, n) mem_align_alloc(x, o, n, struct line, LINES_GRANULARITY)
#define ALIGN_LINE(x, o, n) mem_align_alloc(x, o, n, struct screen_char, LINE_GRANULARITY)
#define ALIGN_LINK(x, o, n) mem_align_alloc(x, o, n, struct link, LINK_GRANULARITY)
#define ALIGN_LINES(x, o, n) mem_align_alloc(x, o, n, LINES_GRANULARITY)
#define ALIGN_LINE(x, o, n) mem_align_alloc(x, o, n, LINE_GRANULARITY)
#define ALIGN_LINK(x, o, n) mem_align_alloc(x, o, n, LINK_GRANULARITY)
#define realloc_points(link, size) \
mem_align_alloc(&(link)->points, (link)->npoints, size, struct point, 0)
mem_align_alloc(&(link)->points, (link)->npoints, size, 0)
struct line *realloc_lines(struct document *document, int y);

View File

@ -424,7 +424,7 @@ abort:
preselect = order;
value = get_attr_val(t_attr, "value", html_context->options);
if (!mem_align_alloc(&values, order, order + 1, unsigned char *, 0xFF))
if (!mem_align_alloc(&values, order, order + 1, 0xFF))
goto abort;
values[order++] = value;

View File

@ -126,7 +126,7 @@ end:
}
#define realloc_chrs(x, l) mem_align_alloc(x, l, (l) + 1, unsigned char, 0xFF)
#define realloc_chrs(x, l) mem_align_alloc(x, l, (l) + 1, 0xFF)
#define add_chr(s, l, c) \
do { \

View File

@ -31,7 +31,7 @@
#define INIT_REAL_ROWS 2
#define realloc_bad_html(bad_html, size) \
mem_align_alloc(bad_html, size, (size) + 1, struct html_start_end, 0xFF)
mem_align_alloc(bad_html, size, (size) + 1, 0xFF)
static void
add_table_bad_html_start(struct table *table, unsigned char *start)

View File

@ -134,7 +134,7 @@ void put_chars(struct html_context *, unsigned char *, int);
#define SPACES_GRANULARITY 0x7F
#define ALIGN_SPACES(x, o, n) mem_align_alloc(x, o, n, unsigned char, SPACES_GRANULARITY)
#define ALIGN_SPACES(x, o, n) mem_align_alloc(x, o, n, SPACES_GRANULARITY)
static inline void
set_screen_char_color(struct screen_char *schar,

View File

@ -24,7 +24,6 @@ static inline struct dom_stack_state *
realloc_dom_stack_states(struct dom_stack_state **states, size_t size)
{
return mem_align_alloc(states, size, size + 1,
struct dom_stack_state,
DOM_STACK_STATE_GRANULARITY);
}
@ -32,7 +31,6 @@ static inline struct dom_stack_state *
realloc_dom_stack_context(struct dom_stack_context ***contexts, size_t size)
{
return mem_align_alloc(contexts, size, size + 1,
struct dom_stack_context *,
DOM_STACK_STATE_GRANULARITY);
}

View File

@ -65,7 +65,7 @@ static struct hash *event_hash = NULL;
#define EVENT_GRANULARITY 0x07
#define realloc_events(ptr, size) \
mem_align_alloc(ptr, (size), (size) + 1, struct event, EVENT_GRANULARITY)
mem_align_alloc(ptr, (size), (size) + 1, EVENT_GRANULARITY)
static inline int
invalid_event_id(register int id)

View File

@ -1406,7 +1406,7 @@ decode_uri_string_for_display(struct string *string)
#define realloc_uri_list(list) \
mem_align_alloc(&(list)->uris, (list)->size, (list)->size + 1, \
struct uri *, URI_LIST_GRANULARITY)
URI_LIST_GRANULARITY)
struct uri *
add_to_uri_list(struct uri_list *list, struct uri *uri)

View File

@ -152,11 +152,11 @@ mem_align_alloc__(
}
#ifdef DEBUG_MEMLEAK
#define mem_align_alloc(ptr, old, new, obj, mask) \
mem_align_alloc__(__FILE__, __LINE__, (void **) ptr, old, new, sizeof(obj), mask)
#define mem_align_alloc(ptr, old, new, mask) \
mem_align_alloc__(__FILE__, __LINE__, (void **) ptr, old, new, sizeof(**ptr), mask)
#else
#define mem_align_alloc(ptr, old, new, obj, mask) \
mem_align_alloc__((void **) ptr, old, new, sizeof(obj), mask)
#define mem_align_alloc(ptr, old, new, mask) \
mem_align_alloc__((void **) ptr, old, new, sizeof(**ptr), mask)
#endif

View File

@ -184,7 +184,7 @@ squeezastring(struct string *string)
#define realloc_string(str, size) \
mem_align_alloc(&(str)->source, (str)->length, (size) + 1, \
unsigned char, STRING_GRANULARITY)
STRING_GRANULARITY)
#ifdef DEBUG_MEMLEAK

View File

@ -206,8 +206,7 @@ find_form_state(struct document_view *doc_view, struct form_control *fc)
if (n >= vs->form_info_len) {
int nn = n + 1;
fs = mem_align_alloc(&vs->form_info, vs->form_info_len, nn,
struct form_state, 0);
fs = mem_align_alloc(&vs->form_info, vs->form_info_len, nn, 0);
if (!fs) return NULL;
vs->form_info = fs;
vs->form_info_len = nn;
@ -629,7 +628,7 @@ encode_controls(struct list_head *l, struct string *data,
#define BOUNDARY_LENGTH 32
#define realloc_bound_ptrs(bptrs, bptrs_size) \
mem_align_alloc(bptrs, bptrs_size, bptrs_size + 1, int, 0xFF)
mem_align_alloc(bptrs, bptrs_size, bptrs_size + 1, 0xFF)
struct boundary_info {
int count;

View File

@ -539,7 +539,7 @@ is_in_range(struct document *document, int y, int height,
}
#define realloc_points(pts, size) \
mem_align_alloc(pts, size, (size) + 1, struct point, 0xFF)
mem_align_alloc(pts, size, (size) + 1, 0xFF)
static void
get_searched_plain(struct document_view *doc_view, struct point **pt, int *pl,

View File

@ -45,7 +45,7 @@ struct line_info {
/* We add two extra entries to the table so the ending info can be added
* without reallocating. */
#define realloc_line_info(info, size) \
mem_align_alloc(info, size, (size) + 3, struct line_info, 0xFF)
mem_align_alloc(info, size, (size) + 3, 0xFF)
/* Allocates a line_info table describing the layout of the textarea buffer.
*