mirror of
https://github.com/antirez/linenoise.git
synced 2026-02-04 12:51:38 +00:00
linenoiseFree() API introduced.
This commit is contained in:
@@ -1050,6 +1050,14 @@ char *linenoise(const char *prompt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is just a wrapper the user may want to call in order to make sure
|
||||||
|
* the linenoise returned buffer is freed with the same allocator it was
|
||||||
|
* created with. Useful when the main program is using an alternative
|
||||||
|
* allocator. */
|
||||||
|
void linenoiseFree(void *ptr) {
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
/* ================================ History ================================= */
|
/* ================================ History ================================= */
|
||||||
|
|
||||||
/* Free the history, but does not reset it. Only used when we have to
|
/* Free the history, but does not reset it. Only used when we have to
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ void linenoiseSetFreeHintsCallback(linenoiseFreeHintsCallback *);
|
|||||||
void linenoiseAddCompletion(linenoiseCompletions *, const char *);
|
void linenoiseAddCompletion(linenoiseCompletions *, const char *);
|
||||||
|
|
||||||
char *linenoise(const char *prompt);
|
char *linenoise(const char *prompt);
|
||||||
|
void linenoiseFree(void *ptr);
|
||||||
int linenoiseHistoryAdd(const char *line);
|
int linenoiseHistoryAdd(const char *line);
|
||||||
int linenoiseHistorySetMaxLen(int len);
|
int linenoiseHistorySetMaxLen(int len);
|
||||||
int linenoiseHistorySave(const char *filename);
|
int linenoiseHistorySave(const char *filename);
|
||||||
|
|||||||
Reference in New Issue
Block a user