types.c
changeset 124 feef7736a439
parent 118 832743d47157
child 140 017f92f7039a
     1.1 --- a/types.c	Mon Feb 11 09:50:17 2008 -0500
     1.2 +++ b/types.c	Fri Feb 15 15:08:38 2008 -0500
     1.3 @@ -63,21 +63,26 @@
     1.4  }
     1.5  
     1.6  void
     1.7 -list_set_array(struct list_head *head, struct array *pool, struct array *items)
     1.8 +list_set_array(struct list_head *head, struct array *pool,
     1.9 +	       struct array *items, int force_indirect)
    1.10  {
    1.11  	struct list *p;
    1.12  
    1.13 -	if (items->size == 0) {
    1.14 -		list_set_empty(head);
    1.15 -	} else if (items->size == sizeof (uint32_t)) {
    1.16 -		head->list_ptr = *(uint32_t *) items->data;
    1.17 -		head->flags = RAZOR_IMMEDIATE;
    1.18 -	} else {
    1.19 -		p = array_add(pool, items->size);
    1.20 -		memcpy(p, items->data, items->size);
    1.21 -		p[items->size / sizeof *p - 1].flags = RAZOR_ENTRY_LAST;
    1.22 -		list_set_ptr(head, p - (struct list *) pool->data);
    1.23 +	if (!force_indirect) {
    1.24 +		if (items->size == 0) {
    1.25 +			list_set_empty(head);
    1.26 +			return;
    1.27 +		} else if (items->size == sizeof (uint32_t)) {
    1.28 +			head->list_ptr = *(uint32_t *) items->data;
    1.29 +			head->flags = RAZOR_IMMEDIATE;
    1.30 +			return;
    1.31 +		}
    1.32  	}
    1.33 +
    1.34 +	p = array_add(pool, items->size);
    1.35 +	memcpy(p, items->data, items->size);
    1.36 +	p[items->size / sizeof *p - 1].flags = RAZOR_ENTRY_LAST;
    1.37 +	list_set_ptr(head, p - (struct list *) pool->data);
    1.38  }
    1.39  
    1.40  struct list *