+static struct list *block_to_list(struct hlsl_block *block) +{ + /* This is a temporary hack to ease the transition from lists to blocks. + * It takes advantage of the fact that an allocated hlsl_block pointer is + * byte-compatible with an allocated list pointer. */ + return (struct list *)block; +} + +static struct hlsl_block *list_to_block(struct list *list) +{ + /* This is a temporary hack to ease the transition from lists to blocks. + * It takes advantage of the fact that an allocated hlsl_block pointer is + * byte-compatible with an allocated list pointer. */ + return (struct hlsl_block *)list; +}
We probably don't care all that much for something temporary like this, but we could as well have done this properly as "return &block->instrs;" and "return CONTAINING_RECORD(list, struct hlsl_block, instrs);".