Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
test dict before giving its size...
authorcoldpeace <coldpeace@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 10 Aug 2010 13:32:07 +0000 (13:32 +0000)
committercoldpeace <coldpeace@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 10 Aug 2010 13:32:07 +0000 (13:32 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8151 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/xbt/dict.c

index 01b1302..b9079c6 100644 (file)
@@ -89,7 +89,7 @@ void xbt_dict_free(xbt_dict_t * dict)
  */
 XBT_INLINE unsigned int xbt_dict_size(xbt_dict_t dict)
 {
  */
 XBT_INLINE unsigned int xbt_dict_size(xbt_dict_t dict)
 {
-  return dict->count;
+  return (dict ? (unsigned int) dict->count : (unsigned int) 0);
 }
 
 /**
 }
 
 /**
@@ -642,7 +642,7 @@ void xbt_dict_dump_output_string(void *s)
  */
 XBT_INLINE int xbt_dict_is_empty(xbt_dict_t dict)
 {
  */
 XBT_INLINE int xbt_dict_is_empty(xbt_dict_t dict)
 {
-       return (xbt_dict_length(dict) == 0);
+       return (xbt_dict_size(dict) == 0);
 }
 
 /**
 }
 
 /**