summaryrefslogtreecommitdiff
path: root/prism/util/pm_string.c
AgeCommit message (Collapse)Author
2024-11-28[ruby/prism] Fix a possible leak of a file descriptorYusuke Endoh
When mmap fails for any reason, the fd must be closed. Coverity Scan found this issue. https://github.com/ruby/prism/commit/c06e9c400f
2024-09-13[ruby/prism] Stat file first to check directoryKevin Newton
https://github.com/ruby/prism/commit/4ed7de537b
2024-09-12[ruby/prism] Check errno for parsing directoryKevin Newton
https://github.com/ruby/prism/commit/d68ea29d04 Notes: Merged: https://github.com/ruby/ruby/pull/11497
2024-09-11[ruby/prism] UTF-8 characters in file nameKevin Newton
https://github.com/ruby/prism/commit/487f0ffe78
2024-09-11[ruby/prism] Parse tempfileKevin Newton
https://github.com/ruby/prism/commit/31154a389a
2024-07-26[ruby/prism] Add explicit check for PRISM_HAS_NO_FILESYSTEMYuta Saito
https://github.com/ruby/prism/commit/89c22f0e6c
2024-07-26[ruby/prism] Fallback to pm_string_file_init on platforms without ↵Yuta Saito
memory-mapped files > ..., and on other POSIX systems we'll use `read`. As `pm_string_mapped_init`'s doc comment says, it should fall back to `read(2)`-based implementation on platforms without memory-mapped files like WASI, but it didn't. This commit fixes it by calling `pm_string_file_init` in the fallback case. Also `defined(_POSIX_MAPPED_FILES)` check for `read(2)`-based path is unnecessary, and it prevents the fallback from being executed, so this change removes it. https://github.com/ruby/prism/commit/b3d9064b71
2024-07-18[PRISM] Ensure not opening directoriesKevin Newton
Notes: Merged: https://github.com/ruby/ruby/pull/11196
2024-05-24[ruby/prism] Remove various unused memsize infraKevin Newton
https://github.com/ruby/prism/commit/283938ed1f
2024-03-07[ruby/prism] Style and allocation functionsKevin Newton
https://github.com/ruby/prism/commit/97f838c323
2024-03-06[ruby/prism] Parse files from Ruby API using fread, not mmapKevin Newton
https://github.com/ruby/prism/commit/62d4376a53
2024-03-04[ruby/prism] Make alloc interface replaceableHASUMI Hitoshi
- Add `x` prefix to malloc, calloc, realloc, and free (eg: malloc -> xmalloc) - By default, they are replaced with stdlib's functions at build - You can use custom functions by defining `PRISM_CUSTOM_ALLOCATOR` macro https://github.com/ruby/prism/commit/7a878af619
2024-02-20[ruby/prism] Use `_POSIX_MAPPED_FILES` and `_WIN32` to know if memory map ↵HASUMI Hitoshi
interface is available in the target platform https://github.com/ruby/prism/commit/88e2ff52d4
2024-02-16[ruby/prism] BuiltinsKevin Newton
https://github.com/ruby/prism/commit/851f2571ff
2024-02-06[ruby/prism] Implement file parsing error handlingeileencodes
This PR implements proper file parsing error handling. Previously `file_options` would call `pm_string_mapped_init` which would print an error from `perror`. However this wouldn't raise a proper Ruby error so it was just a string output. I've done the following: - Raise an error from `rb_syserr_fail` with the filepath in `file_options`. - No longer return `Qnil` if `file_options` returns false (because now it will raise) - Update `file_options` to return `static void` instead of `static bool`. - Update `file_options` and `profile_file` to check the type so when passing `nil` we see a `TypeError`. - Delete `perror` from `pm_string_mapped_init` - Update `FFI` backend to raise appropriate errors when calling `pm_string_mapped_init`. - Add tests for `dump_file`, `lex_file`, `parse_file`, `parse_file_comments`, `parse_lex_file`, and `parse_file_success?` when a file doesn't exist and for `nil`. - Updates the `bin/parse` script to no longer raise it's own `ArgumentError` now that we raise a proper error. Fixes: ruby/prism#2207 https://github.com/ruby/prism/commit/b2f7494ff5
2023-11-01[ruby/prism] Fix up lintKevin Newton
https://github.com/ruby/prism/commit/77d4056766
2023-11-01[ruby/prism] Even more C documentationKevin Newton
https://github.com/ruby/prism/commit/bec5ca37a0
2023-11-01[ruby/prism] Start better documenting C APIKevin Newton
https://github.com/ruby/prism/commit/2b6e661bbc
2023-09-27Sync to prism rename commitsKevin Newton
2023-09-27Rename YARP filepaths to prism filepathsKevin Newton