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.
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.
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.
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.
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.