зеркало из https://github.com/github/ruby.git
[ruby/prism] Add explicit check for PRISM_HAS_NO_FILESYSTEM
https://github.com/ruby/prism/commit/89c22f0e6c
This commit is contained in:
Родитель
1992bd31a5
Коммит
a65c205a1b
|
@ -118,6 +118,15 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* If PRISM_HAS_NO_FILESYSTEM is defined, then we want to exclude all filesystem
|
||||
* related code from the library. All filesystem related code should be guarded
|
||||
* by PRISM_HAS_FILESYSTEM.
|
||||
*/
|
||||
#ifndef PRISM_HAS_NO_FILESYSTEM
|
||||
# define PRISM_HAS_FILESYSTEM
|
||||
#endif
|
||||
|
||||
/**
|
||||
* isinf on Windows is defined as accepting a float, but on POSIX systems it
|
||||
* accepts a float, a double, or a long double. We want to mirror this behavior
|
||||
|
|
|
@ -202,7 +202,7 @@ pm_string_file_init(pm_string_t *string, const char *filepath) {
|
|||
CloseHandle(file);
|
||||
*string = (pm_string_t) { .type = PM_STRING_OWNED, .source = source, .length = (size_t) file_size };
|
||||
return true;
|
||||
#else
|
||||
#elif defined(PRISM_HAS_FILESYSTEM)
|
||||
FILE *file = fopen(filepath, "rb");
|
||||
if (file == NULL) {
|
||||
return false;
|
||||
|
@ -241,6 +241,11 @@ pm_string_file_init(pm_string_t *string, const char *filepath) {
|
|||
|
||||
*string = (pm_string_t) { .type = PM_STRING_OWNED, .source = source, .length = length };
|
||||
return true;
|
||||
#else
|
||||
(void) string;
|
||||
(void) filepath;
|
||||
perror("pm_string_file_init is not implemented for this platform");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче