MCPcopy Create free account
hub / github.com/apache/singa / tinydir_open_subdir_n

Function tinydir_open_subdir_n

include/singa/utils/tinydir.h:391–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389}
390
391_TINYDIR_FUNC
392int tinydir_open_subdir_n(tinydir_dir *dir, size_t i) {
393 char path[_TINYDIR_PATH_MAX];
394 if (dir == NULL) {
395 errno = EINVAL;
396 return -1;
397 }
398 if (i >= dir->n_files || !dir->_files[i].is_dir) {
399 errno = ENOENT;
400 return -1;
401 }
402
403 strcpy(path, dir->_files[i].path);
404 tinydir_close(dir);
405 if (tinydir_open_sorted(dir, path) == -1) {
406 return -1;
407 }
408
409 return 0;
410}
411
412/* Open a single file given its path */
413_TINYDIR_FUNC

Callers

nothing calls this directly

Calls 2

tinydir_closeFunction · 0.85
tinydir_open_sortedFunction · 0.85

Tested by

no test coverage detected