direct-io.hg

changeset 13786:a357bed2daf8

Make the string->string map and int->float map allocation functions set the
map size on allocation.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Feb 01 19:00:17 2007 +0000 (2007-02-01)
parents 23bf61e72279
children 0fb5df09de94
files tools/libxen/src/xen_int_float_map.c tools/libxen/src/xen_string_string_map.c
line diff
     1.1 --- a/tools/libxen/src/xen_int_float_map.c	Thu Feb 01 18:45:50 2007 +0000
     1.2 +++ b/tools/libxen/src/xen_int_float_map.c	Thu Feb 01 19:00:17 2007 +0000
     1.3 @@ -25,8 +25,10 @@
     1.4  xen_int_float_map *
     1.5  xen_int_float_map_alloc(size_t size)
     1.6  {
     1.7 -    return calloc(1, sizeof(xen_int_float_map) +
     1.8 -                  size * sizeof(struct xen_int_float_map_contents));
     1.9 +    xen_int_float_map *result = calloc(1, sizeof(xen_int_float_map) +
    1.10 +                                       size * sizeof(struct xen_int_float_map_contents));
    1.11 +    result->size = size;
    1.12 +    return result;
    1.13  }
    1.14  
    1.15  
     2.1 --- a/tools/libxen/src/xen_string_string_map.c	Thu Feb 01 18:45:50 2007 +0000
     2.2 +++ b/tools/libxen/src/xen_string_string_map.c	Thu Feb 01 19:00:17 2007 +0000
     2.3 @@ -25,8 +25,10 @@
     2.4  xen_string_string_map *
     2.5  xen_string_string_map_alloc(size_t size)
     2.6  {
     2.7 -    return calloc(1, sizeof(xen_string_string_map) +
     2.8 -                  size * sizeof(struct xen_string_string_map_contents));
     2.9 +    xen_string_string_map *result = calloc(1, sizeof(xen_string_string_map) +
    2.10 +                                           size * sizeof(struct xen_string_string_map_contents));
    2.11 +    result->size = size;
    2.12 +    return result;
    2.13  }
    2.14  
    2.15