From 2db474be28f1724af8093b04f896cf7ae33411fb Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Tue, 1 Dec 2020 15:46:05 +0100 Subject: [PATCH] std.stdio: Deprecate extern(C) getdelim The publicly available `extern(C)` binding for `getdelim` in `std.stdio` has been deprecated. Any code that still needs it can import the symbol from `core.sys.posix.stdio` in druntime instead. --- changelog/deprecate-stdio-bindings.dd | 8 ++++---- std/stdio.d | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/changelog/deprecate-stdio-bindings.dd b/changelog/deprecate-stdio-bindings.dd index 5b9a1e26a..c686616e8 100644 --- a/changelog/deprecate-stdio-bindings.dd +++ b/changelog/deprecate-stdio-bindings.dd @@ -1,5 +1,5 @@ -Deprecate `std.stdio.getline` +Deprecate `std.stdio.getdelim` and `std.stdio.getline` -The publicly available `extern(C)` binding for `getline` in `std.stdio` has -been deprecated. Any code that still needs it can import the symbol from -`core.sys.posix.stdio` in druntime instead. +The publicly available `extern(C)` bindings for `getdelim` and `getline` in +`std.stdio` have been deprecated. Any code that still needs it can import the +symbol from `core.sys.posix.stdio` in druntime instead. diff --git a/std/stdio.d b/std/stdio.d index ed1a4226b..29813a72e 100644 --- a/std/stdio.d +++ b/std/stdio.d @@ -256,6 +256,8 @@ static if (__traits(compiles, core.sys.posix.stdio.getdelim)) { extern(C) nothrow @nogc { + // @@@DEPRECATED_2.104@@@ + deprecated("To be removed after 2.104. Use core.sys.posix.stdio.getline instead.") ptrdiff_t getdelim(char**, size_t*, int, FILE*); // @@@DEPRECATED_2.104@@@ @@ -5497,7 +5499,7 @@ private size_t readlnImpl(FILE* fps, ref char[] buf, dchar terminator, File.Orie } } - auto s = getdelim(&lineptr, &n, terminator, fps); + auto s = core.sys.posix.stdio.getdelim(&lineptr, &n, terminator, fps); if (s < 0) { if (ferror(fps))