-
Notifications
You must be signed in to change notification settings - Fork 751
Remove max path #5389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Remove max path #5389
Conversation
I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
48e29a4 to
35143c8
Compare
GNU HURD does not define the optional POSIX MAX_PATH value. This changes all path buffers to use dynamic array sizing.
mawww
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I did enjoy avoiding those allocations, if this breaks build on Hurd I think it makes sense to have more portable and robust code.
| return mkstemp(buffer); | ||
| char* tmplt = strndup(buffer.c_str(), (size_t)buffer.length()); | ||
| int fp = mkstemp(tmplt); | ||
| buffer = tmplt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren´t we leaking tmplt here ? I am not sure why we need the strndup call in the first place, you can just use mkstemp(buffer.data()) which will be a pointer to the buffer string buffer and can be mutated safely as long as the string length does not change.
| StringView existing = filename; | ||
| StringView non_existing{}; | ||
|
|
||
| using unique_cstr = std::unique_ptr<char, MallocDeleter>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kakoune moved away to a custom UniquePtr implementation for compilation speed reasons, it does not support custom deleters as we did not have actual uses, but in this specific case a OnScopeEnd free{[&] { free(res); }; would probably do the trick.
| void write(int fd, StringView data); | ||
| void write_to_file(StringView filename, StringView data); | ||
| int create_file(const char* filename); | ||
| int open_temp_file(StringView filename, String &tmpFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do not use camel case for parameters in kakoune, it should be tmp_file
This commit changes the relevant internal path buffers to use dynamic array sizing and allows Kakoune to build on GNU HURD.