Nullability check for fts module
Bugs: b/245972273
Test: adb shell
Change-Id: I56f796a3968484c69c3389fffafdbd960a99845f
diff --git a/libc/include/fts.h b/libc/include/fts.h
index 7e63111..bae2615 100644
--- a/libc/include/fts.h
+++ b/libc/include/fts.h
@@ -39,15 +39,15 @@
#include <sys/types.h>
typedef struct {
- struct _ftsent *fts_cur; /* current node */
- struct _ftsent *fts_child; /* linked list of children */
- struct _ftsent **fts_array; /* sort array */
+ struct _ftsent * _Nullable fts_cur; /* current node */
+ struct _ftsent * _Nullable fts_child; /* linked list of children */
+ struct _ftsent * _Nullable * _Nullable fts_array; /* sort array */
dev_t fts_dev; /* starting device # */
- char *fts_path; /* path for this descent */
+ char * _Nullable fts_path; /* path for this descent */
int fts_rfd; /* fd for root */
size_t fts_pathlen; /* sizeof(path) */
int fts_nitems; /* elements in the sort array */
- int (*fts_compar)(); /* compare function */
+ int (* _Nullable fts_compar)(); /* compare function */
#define FTS_COMFOLLOW 0x0001 /* follow command line symlinks */
#define FTS_LOGICAL 0x0002 /* logical walk */
@@ -65,13 +65,13 @@
} FTS;
typedef struct _ftsent {
- struct _ftsent *fts_cycle; /* cycle node */
- struct _ftsent *fts_parent; /* parent directory */
- struct _ftsent *fts_link; /* next file in directory */
+ struct _ftsent * _Nullable fts_cycle; /* cycle node */
+ struct _ftsent * _Nullable fts_parent; /* parent directory */
+ struct _ftsent * _Nullable fts_link; /* next file in directory */
long fts_number; /* local numeric value */
- void *fts_pointer; /* local address value */
- char *fts_accpath; /* access path */
- char *fts_path; /* root path */
+ void * _Nullable fts_pointer; /* local address value */
+ char * _Nullable fts_accpath; /* access path */
+ char * _Nullable fts_path; /* root path */
int fts_errno; /* errno for this node */
int fts_symfd; /* fd for symlink */
size_t fts_pathlen; /* strlen(fts_path) */
@@ -111,7 +111,7 @@
#define FTS_SKIP 4 /* discard node */
unsigned short fts_instr; /* fts_set() instructions */
- struct stat *fts_statp; /* stat(2) information */
+ struct stat * _Nullable fts_statp; /* stat(2) information */
char fts_name[1]; /* file name */
} FTSENT;
@@ -122,11 +122,11 @@
* breakage in 21 that means you can't write code that runs on current devices and pre-21 devices,
* so we break the tie in favor of current and future devices.
*/
-FTSENT* fts_children(FTS* __fts, int __options) __INTRODUCED_IN(21);
-int fts_close(FTS* __fts) __INTRODUCED_IN(21);
-FTS* fts_open(char* const* __path, int __options, int (*__comparator)(const FTSENT** __lhs, const FTSENT** __rhs)) __INTRODUCED_IN(21);
-FTSENT* fts_read(FTS* __fts) __INTRODUCED_IN(21);
-int fts_set(FTS* __fts, FTSENT* __entry, int __options) __INTRODUCED_IN(21);
+FTSENT* _Nullable fts_children(FTS* _Nonnull __fts, int __options) __INTRODUCED_IN(21);
+int fts_close(FTS* _Nonnull __fts) __INTRODUCED_IN(21);
+FTS* _Nullable fts_open(char* _Nonnull const* _Nonnull __path, int __options, int (* _Nullable __comparator)(const FTSENT* _Nonnull * _Nonnull __lhs, const FTSENT* _Nonnull * _Nonnull __rhs)) __INTRODUCED_IN(21);
+FTSENT* _Nullable fts_read(FTS* _Nonnull __fts) __INTRODUCED_IN(21);
+int fts_set(FTS* _Nonnull __fts, FTSENT* _Nonnull __entry, int __options) __INTRODUCED_IN(21);
__END_DECLS