Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Set the cursor to NULL before use in an iteration
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 28 Jan 2004 23:56:32 +0000 (23:56 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 28 Jan 2004 23:56:32 +0000 (23:56 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@19 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/dict.h

index f6e70b0..1719cc9 100644 (file)
@@ -139,8 +139,8 @@ void         gras_dict_cursor_step        (gras_dict_cursor_t  *cursor);
 int          gras_dict_cursor_get_or_free (gras_dict_cursor_t **cursor,
                                           char               **key,
                                           void               **data);
 int          gras_dict_cursor_get_or_free (gras_dict_cursor_t **cursor,
                                           char               **key,
                                           void               **data);
-#define gras_dict_foreach(dict,cursor,key,data)                \
-  for (gras_dict_cursor_first((dict),&(cursor)) ;              \
+#define gras_dict_foreach(dict,cursor,key,data)                        \
+  for (cursor=NULL, gras_dict_cursor_first((dict),&(cursor)) ;         \
        gras_dict_cursor_get_or_free(&(cursor),&(key),(void**)(&data)); \
        gras_dict_cursor_step(cursor) )
 
        gras_dict_cursor_get_or_free(&(cursor),&(key),(void**)(&data)); \
        gras_dict_cursor_step(cursor) )