summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2014-02-04 20:04:46 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2014-02-04 20:04:46 +0000
commit45b4c4995e53b0cbc25a0b100006e829b205de9c (patch)
tree9347e578cf6bf48df9467bd465b3a5f4d03bb816
parent7fe6441cc3500dfa83dfebcb042aeab4871846ea (diff)
downloadbcm5719-llvm-45b4c4995e53b0cbc25a0b100006e829b205de9c.tar.gz
bcm5719-llvm-45b4c4995e53b0cbc25a0b100006e829b205de9c.zip
Avoid using EL_GETFP.
This should fix the build against old versions of libedit. llvm-svn: 200794
-rw-r--r--llvm/lib/LineEditor/LineEditor.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/LineEditor/LineEditor.cpp b/llvm/lib/LineEditor/LineEditor.cpp
index 80c80800202..a50ccc388f1 100644
--- a/llvm/lib/LineEditor/LineEditor.cpp
+++ b/llvm/lib/LineEditor/LineEditor.cpp
@@ -102,6 +102,8 @@ struct LineEditor::InternalData {
unsigned PrevCount;
std::string ContinuationOutput;
+
+ FILE *Out;
};
static const char *ElGetPromptFn(EditLine *EL) {
@@ -120,9 +122,7 @@ static unsigned char ElCompletionFn(EditLine *EL, int ch) {
if (el_get(EL, EL_CLIENTDATA, &Data) == 0) {
if (!Data->ContinuationOutput.empty()) {
// This is the continuation of the AK_ShowCompletions branch below.
- FILE *Out;
- if (::el_get(EL, EL_GETFP, 1, &Out) != 0)
- return CC_ERROR;
+ FILE *Out = Data->Out;
// Print the required output (see below).
::fwrite(Data->ContinuationOutput.c_str(),
@@ -198,6 +198,7 @@ LineEditor::LineEditor(StringRef ProgName, StringRef HistoryPath, FILE *In,
this->HistoryPath = getDefaultHistoryPath(ProgName);
Data->LE = this;
+ Data->Out = Out;
Data->Hist = ::history_init();
assert(Data->Hist);
@@ -228,15 +229,9 @@ LineEditor::LineEditor(StringRef ProgName, StringRef HistoryPath, FILE *In,
LineEditor::~LineEditor() {
saveHistory();
- FILE *Out;
- if (::el_get(Data->EL, EL_GETFP, 1, &Out) != 0)
- Out = 0;
-
::history_end(Data->Hist);
::el_end(Data->EL);
-
- if (Out)
- ::fwrite("\n", 1, 1, Out);
+ ::fwrite("\n", 1, 1, Data->Out);
}
void LineEditor::saveHistory() {
OpenPOWER on IntegriCloud