mirror of
https://github.com/rkd77/elinks.git
synced 2024-09-30 03:26:23 -04:00
get_dom_stack_state_data(): Make static inline and handle zero object size
This commit is contained in:
parent
9360f88d65
commit
419d9d165a
@ -93,8 +93,18 @@ get_dom_stack_state(struct dom_stack *stack, int top_offset)
|
|||||||
#define get_dom_stack_parent(stack) get_dom_stack_state(stack, 1)
|
#define get_dom_stack_parent(stack) get_dom_stack_state(stack, 1)
|
||||||
#define get_dom_stack_top(stack) get_dom_stack_state(stack, 0)
|
#define get_dom_stack_top(stack) get_dom_stack_state(stack, 0)
|
||||||
|
|
||||||
#define get_dom_stack_state_data(context, state) \
|
static inline void *
|
||||||
((void *) &(context)->state_objects[(state)->depth * (context)->info->object_size])
|
get_dom_stack_state_data(struct dom_stack_context *context,
|
||||||
|
struct dom_stack_state *state)
|
||||||
|
{
|
||||||
|
size_t object_size = context->info->object_size;
|
||||||
|
|
||||||
|
if (!object_size) return NULL;
|
||||||
|
|
||||||
|
assertm(context->state_objects);
|
||||||
|
|
||||||
|
return (void *) &context->state_objects[state->depth * object_size];
|
||||||
|
}
|
||||||
|
|
||||||
/* The state iterators do not include the bottom state */
|
/* The state iterators do not include the bottom state */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user