Getter for number of children in a dir.

This commit is contained in:
Vreixo Formoso 2007-12-01 01:45:35 +01:00
parent a4f283fac6
commit e068fd1cf6
2 changed files with 26 additions and 0 deletions

View File

@ -124,4 +124,14 @@ int iso_dir_add_node(IsoDir *dir, IsoNode *child);
*/ */
int iso_dir_get_node(IsoDir *dir, const char *name, IsoNode **node); int iso_dir_get_node(IsoDir *dir, const char *name, IsoNode **node);
/**
* Get the number of children of a directory.
*
* @return
* >= 0 number of items, < 0 error
* Possible errors:
* ISO_NULL_POINTER, if dir is NULL
*/
int iso_dir_get_nchildren(IsoDir *dir);
#endif /*LIBISO_LIBISOFS_H_*/ #endif /*LIBISO_LIBISOFS_H_*/

View File

@ -198,3 +198,19 @@ int iso_dir_get_node(IsoDir *dir, const char *name, IsoNode **node)
*node = pos; *node = pos;
return 1; return 1;
} }
/**
* Get the number of children of a directory.
*
* @return
* >= 0 number of items, < 0 error
* Possible errors:
* ISO_NULL_POINTER, if dir is NULL
*/
int iso_dir_get_nchildren(IsoDir *dir)
{
if (dir == NULL) {
return ISO_NULL_POINTER;
}
return dir->nchildren;
}