Getter for number of children in a dir.
This commit is contained in:
parent
a4f283fac6
commit
e068fd1cf6
@ -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);
|
||||
|
||||
/**
|
||||
* 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_*/
|
||||
|
16
src/node.c
16
src/node.c
@ -198,3 +198,19 @@ int iso_dir_get_node(IsoDir *dir, const char *name, IsoNode **node)
|
||||
*node = pos;
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user