Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert changes from GNU readline 5.0
There are two changes: one whitespace-only change in `input.c`, and one change in `readline.c` which was (by rumor) thought to solve a memory leak. It is, however, a no-op: ``` #define USE_STATIC // ... char * readline (prompt) const char *prompt; { char *value; // was initialized with NULL before #ifdef USE_STATIC static char result[4096]; #endif // ... #ifdef USE_STATIC memset (result, 0, 4096); if (value) { strcpy (result, value); free (value); } return (strdup (result)); #else return (value); #endif } ``` The initialization of value with NULL GNU readline was gone, and the code within `USE_STATIC` (and the `#define` itself) was added. The code takes the original value that comes in `value`, copies it into a static area `result`, and then frees the original `value` (which assumes that `result` was allocated with `malloc` before). The copied string is then again duplicated (which implies creating the required size with `malloc`), and returned. The copied string does not differ from the original one: both are `malloc`ed and need to be `free`d by the caller. So, this does not fix a memory leak. Reverting this, however, makes the directory `vendor$readline/` identical to the original GNU readline (except the `Makefile.in` adaption, and the documentation), so that it is clean that it can be replaced by linking to the system`'s readline.
- Loading branch information