diff options
author | William Wilgus <me.theuser@yahoo.com> | 2024-05-02 13:38:32 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2024-05-02 13:38:32 -0400 |
commit | efcea6628024c5f6796c3850c3779801db4b6874 (patch) | |
tree | 6b0a5ce6ce0ddb46de5e412dae110d9ba99414d5 /firmware/common | |
parent | 0c737d3b2e4728347cf4d52025f9fc2ebbee6e90 (diff) | |
download | rockbox-efcea6628024c5f6796c3850c3779801db4b6874.tar.gz rockbox-efcea6628024c5f6796c3850c3779801db4b6874.zip |
Revert "readdir_r use in tagcache.check_dir, ft_load"
This reverts commit 0c737d3b2e4728347cf4d52025f9fc2ebbee6e90.
Reason for revert: Not really a concern as open_stream returns an independent buffer since g#566
Change-Id: Idbd2f4a7cc2ea6362b7714629469eeb7b3d19b3b
Diffstat (limited to 'firmware/common')
-rw-r--r-- | firmware/common/dir.c | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/firmware/common/dir.c b/firmware/common/dir.c index 27af5f7fca..9a78d910a7 100644 --- a/firmware/common/dir.c +++ b/firmware/common/dir.c | |||
@@ -159,7 +159,6 @@ file_error: | |||
159 | return rc; | 159 | return rc; |
160 | } | 160 | } |
161 | 161 | ||
162 | #if 0 | ||
163 | /* read a directory */ | 162 | /* read a directory */ |
164 | struct dirent * readdir(DIR *dirp) | 163 | struct dirent * readdir(DIR *dirp) |
165 | { | 164 | { |
@@ -183,19 +182,23 @@ file_error: | |||
183 | 182 | ||
184 | return res; | 183 | return res; |
185 | } | 184 | } |
186 | #endif | ||
187 | 185 | ||
188 | /* readdir, readdir_r common fn */ | 186 | #if 0 /* not included now but probably should be */ |
189 | static int readdir_common(DIR *dirp, struct dirent *entry, struct dirent **result) | 187 | /* read a directory (reentrant) */ |
188 | int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) | ||
190 | { | 189 | { |
191 | *result = NULL; /* we checked for validity before calling, yes? */ | 190 | if (!result) |
191 | FILE_ERROR_RETURN(EFAULT, -2); | ||
192 | |||
193 | *result = NULL; | ||
194 | |||
195 | if (!entry) | ||
196 | FILE_ERROR_RETURN(EFAULT, -3); | ||
197 | |||
192 | struct dirstr_desc * const dir = GET_DIRSTR(READER, dirp); | 198 | struct dirstr_desc * const dir = GET_DIRSTR(READER, dirp); |
193 | if (!dir) | 199 | if (!dir) |
194 | FILE_ERROR_RETURN(ERRNO, -1); | 200 | FILE_ERROR_RETURN(ERRNO, -1); |
195 | 201 | ||
196 | if (!entry) | ||
197 | entry = &dir->entry; | ||
198 | |||
199 | int rc = ns_readdir_dirent(&dir->stream, &dir->scan, entry); | 202 | int rc = ns_readdir_dirent(&dir->stream, &dir->scan, entry); |
200 | if (rc < 0) | 203 | if (rc < 0) |
201 | FILE_ERROR(EIO, rc * 10 - 4); | 204 | FILE_ERROR(EIO, rc * 10 - 4); |
@@ -215,27 +218,6 @@ file_error: | |||
215 | return rc; | 218 | return rc; |
216 | } | 219 | } |
217 | 220 | ||
218 | /* read a directory */ | ||
219 | struct dirent * readdir(DIR *dirp) | ||
220 | { | ||
221 | struct dirent *entry; | ||
222 | readdir_common(dirp, NULL, &entry); | ||
223 | return entry; | ||
224 | } | ||
225 | |||
226 | /* read a directory (reentrant) */ | ||
227 | int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) | ||
228 | { | ||
229 | if (!result) | ||
230 | FILE_ERROR_RETURN(EFAULT, -2); | ||
231 | *result = NULL; | ||
232 | if (!entry) | ||
233 | FILE_ERROR_RETURN(EFAULT, -3); | ||
234 | return readdir_common(dirp, entry, result); | ||
235 | } | ||
236 | |||
237 | |||
238 | #if 0 /* not included now but probably should be */ | ||
239 | /* reset the position of a directory stream to the beginning of a directory */ | 221 | /* reset the position of a directory stream to the beginning of a directory */ |
240 | void rewinddir(DIR *dirp) | 222 | void rewinddir(DIR *dirp) |
241 | { | 223 | { |