-#include <excludes.h>
-#include <vector.h>
-
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(tesh);
-
-excludes_t
-excludes_new(void)
+#include <excludes.h>\r
+#include <fstream.h>\r
+\r XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(tesh);
+\r\rexcludes_t \r excludes_new(void) \r
{
- excludes_t excludes = xbt_new0(s_excludes_t, 1);
-
- if(!(excludes->items = vector_new(8,NULL)))
- {
- free(excludes);
- return NULL;
- }
-
- return excludes;
-}
+ \rexcludes_t excludes = xbt_new0(s_excludes_t, 1);
+ \r\rexcludes->items =
+ xbt_dynar_new(sizeof(fstream_t), (void_f_pvoid_t) fstream_free);
+ \r\rreturn excludes;
+\r}
-int
-excludes_is_empty(excludes_t excludes)
+\r\rint \r excludes_is_empty(excludes_t excludes) \r
{
- if(!excludes)
- {
- errno = EINVAL;
- return 0;
- }
-
- return vector_is_empty(excludes->items);
-}
+ \rif (!excludes)
+ \r {
+ \rerrno = EINVAL;
+ \rreturn 0;
+ \r}
+ \r\rreturn (0 == xbt_dynar_length(excludes->items));
+\r}
-int
-excludes_contains(excludes_t excludes, fstream_t fstream)
+\r\rint \r excludes_contains(excludes_t excludes, fstream_t fstream) \r
{
- fstream_t cur;
-
- if(!excludes || !fstream)
- {
- errno = EINVAL;
- return 0;
- }
-
- vector_rewind(excludes->items);
-
- while((cur = vector_get(excludes->items)))
- {
- if(!strcmp(fstream->name, cur->name) && !strcmp(fstream->directory, cur->directory))
- return 1;
-
- vector_move_next(excludes->items);
- }
-
- return 0;
-}
+ \rfstream_t cur;
+ \runsigned int i;
+ \r\rif (!excludes || !fstream)
+ \r {
+ \rerrno = EINVAL;
+ \rreturn 0;
+ \r}
+ \r\rxbt_dynar_foreach(excludes->items, i, cur) \r {
+ \rif (!strcmp(fstream->name, cur->name)
+ && !strcmp(fstream->directory, cur->directory))
+ \rreturn 1;
+ \r}
+ \r\rreturn 0;
+\r}
-int
-excludes_add(excludes_t excludes, fstream_t fstream)
+\r\rint \r excludes_add(excludes_t excludes, fstream_t fstream) \r
{
- if(!excludes)
- return EINVAL;
-
- if(excludes_contains(excludes, fstream))
- return EEXIST;
-
- return vector_push_back(excludes->items, fstream);
-}
+ \rif (!excludes)
+ \rreturn EINVAL;
+ \r\rif (excludes_contains(excludes, fstream))
+ \rreturn EEXIST;
+ \r\rxbt_dynar_push(excludes->items, &fstream);
+ \r\rreturn 0;
+\r}
-int
-excludes_check(excludes_t excludes, fstreams_t fstreams)
+\r\rint \r excludes_check(excludes_t excludes, fstreams_t fstreams) \r
{
- fstream_t exclude;
- fstream_t fstream;
- int success = 1;
- int exists;
-
- if(!excludes || !fstreams)
- return EINVAL;
-
- vector_rewind(excludes->items);
-
- while((exclude = vector_get(excludes->items)))
- {
- vector_rewind(fstreams->items);
-
- while((fstream = vector_get(fstreams->items)))
- {
- exists = 0;
-
- if(!strcmp(fstream->name, exclude->name) && !strcmp(fstream->directory, exclude->directory))
- {
- exists = 1;
- break;
- }
-
- vector_move_next(fstreams->items);
- }
-
- if(!exists)
- {
- success = 0;
- WARN1("cannot exclude the file %s",exclude->name);
- }
-
- vector_move_next(excludes->items);
- }
-
- return success;
-}
+ \rfstream_t exclude;
+ \rfstream_t fstream;
+ \rint success = 1;
+ \rint exists;
+ \runsigned int i;
+ \r\rif (!excludes || !fstreams)
+ \rreturn EINVAL;
+ \r\r\rxbt_dynar_foreach(excludes->items, i, exclude) \r {
+ \rexists = 1;
+ \r\rxbt_dynar_foreach(fstreams->items, i, fstream) \r {
+ \rexists = 0;
+ \r\rif (!strcmp(fstream->name, exclude->name)
+ && !strcmp(fstream->directory, exclude->directory))
+ \r {
+ \rexists = 1;
+ \rbreak;
+ \r}
+ \r}
+ \r\rif (!exists)
+ \r {
+ \rsuccess = 0;
+ \rWARN1("cannot exclude the file %s", exclude->name);
+ \r}
+ \r}
+ \r\rreturn success;
+\r}
-int
-excludes_free(void** excludesptr)
+\r\rint \r excludes_free(void **excludesptr) \r
{
- if(!(*excludesptr))
- return EINVAL;
-
- if((errno =vector_free((&(*((excludes_t*)excludesptr))->items))))
- return errno;
-
- free(*excludesptr);
- *excludesptr = NULL;
-
- return 0;
-}
+ \rif (!(*excludesptr))
+ \rreturn EINVAL;
+ \r\rif ((*((excludes_t *) excludesptr))->items)
+ \rxbt_dynar_free((&(*((excludes_t *) excludesptr))->items));
+ \r\rfree(*excludesptr);
+ \r*excludesptr = NULL;
+ \r\rreturn 0;
+\r}
+
+\r