optimized ucx_map_clear (noop for count == 0)

Thu, 15 Oct 2015 12:39:50 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 15 Oct 2015 12:39:50 +0200
changeset 207
1de85ecf6adc
parent 206
58b77eb51afd
child 208
262c7be94eba

optimized ucx_map_clear (noop for count == 0)

ucx/map.c file | annotate | diff | comparison | revisions
     1.1 --- a/ucx/map.c	Thu Oct 15 12:34:10 2015 +0200
     1.2 +++ b/ucx/map.c	Thu Oct 15 12:39:50 2015 +0200
     1.3 @@ -83,6 +83,9 @@
     1.4  }
     1.5  
     1.6  void ucx_map_clear(UcxMap *map) {
     1.7 +    if (map->count == 0) {
     1.8 +        return; // nothing to do
     1.9 +    }
    1.10      ucx_map_free_elmlist_contents(map);
    1.11      memset(map->map, 0, map->size*sizeof(UcxMapElement*));
    1.12      map->count = 0;

mercurial