Browse Source

Getter for number of children in a dir.

release-1.5.4.branch
Vreixo Formoso 14 years ago
parent
commit
e068fd1cf6
  1. 10
      src/libisofs.h
  2. 16
      src/node.c

10
src/libisofs.h

@ -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

@ -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…
Cancel
Save