mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 06:00:35 +03:00
Merge pull request #2330 from joakim-noah/strerror_move
Deprecate std.c.string and move its contents to druntime
This commit is contained in:
commit
3cd7afcb1b
9 changed files with 17 additions and 38 deletions
|
@ -16,7 +16,7 @@ import core.memory, core.bitop;
|
|||
import std.algorithm, std.ascii, std.conv, std.exception, std.functional,
|
||||
std.range, std.string, std.traits, std.typecons, std.typetuple,
|
||||
std.uni, std.utf;
|
||||
import std.c.string : memcpy;
|
||||
import core.stdc.string : memcpy;
|
||||
version(unittest) import core.exception, std.stdio;
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,26 +9,5 @@
|
|||
|
||||
module std.c.string;
|
||||
|
||||
deprecated("Please import core.stdc.string instead.")
|
||||
public import core.stdc.string;
|
||||
|
||||
extern (C):
|
||||
|
||||
version (Windows)
|
||||
{
|
||||
int memicmp(in char* s1, in char* s2, size_t n);
|
||||
}
|
||||
|
||||
version (linux)
|
||||
{
|
||||
const(char)* strerror_r(int errnum, char* buf, size_t buflen);
|
||||
}
|
||||
|
||||
version (OSX)
|
||||
{
|
||||
int strerror_r(int errnum, char* buf, size_t buflen);
|
||||
}
|
||||
|
||||
version (FreeBSD)
|
||||
{
|
||||
int strerror_r(int errnum, char* buf, size_t buflen);
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ else version(Posix)
|
|||
|
||||
version(unittest)
|
||||
{
|
||||
import std.c.string;
|
||||
import core.stdc.string;
|
||||
import std.stdio;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
+/
|
||||
module std.exception;
|
||||
|
||||
import std.array, std.c.string, std.conv, std.range, std.string, std.traits;
|
||||
import core.exception, core.stdc.errno;
|
||||
import std.array, std.conv, std.range, std.string, std.traits;
|
||||
import core.exception, core.stdc.errno, core.stdc.string;
|
||||
|
||||
/++
|
||||
Asserts that the given expression does $(I not) throw the given type
|
||||
|
@ -1379,11 +1379,11 @@ class ErrnoException : Exception
|
|||
version (linux)
|
||||
{
|
||||
char[1024] buf = void;
|
||||
auto s = std.c.string.strerror_r(errno, buf.ptr, buf.length);
|
||||
auto s = core.stdc.string.strerror_r(errno, buf.ptr, buf.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto s = std.c.string.strerror(errno);
|
||||
auto s = core.stdc.string.strerror(errno);
|
||||
}
|
||||
super(msg~" ("~to!string(s)~")", file, line);
|
||||
}
|
||||
|
|
|
@ -2075,16 +2075,16 @@ class ProcessException : Exception
|
|||
size_t line = __LINE__)
|
||||
{
|
||||
import core.stdc.errno;
|
||||
import std.c.string;
|
||||
import core.stdc.string;
|
||||
version (linux)
|
||||
{
|
||||
char[1024] buf;
|
||||
auto errnoMsg = to!string(
|
||||
std.c.string.strerror_r(errno, buf.ptr, buf.length));
|
||||
core.stdc.string.strerror_r(errno, buf.ptr, buf.length));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto errnoMsg = to!string(std.c.string.strerror(errno));
|
||||
auto errnoMsg = to!string(core.stdc.string.strerror(errno));
|
||||
}
|
||||
auto msg = customMsg.empty ? errnoMsg
|
||||
: customMsg ~ " (" ~ errnoMsg ~ ')';
|
||||
|
@ -2962,7 +2962,7 @@ import std.c.stdlib;
|
|||
import core.stdc.errno;
|
||||
import core.thread;
|
||||
import std.c.process;
|
||||
import std.c.string;
|
||||
import core.stdc.string;
|
||||
|
||||
version (Windows)
|
||||
{
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
module std.socket;
|
||||
|
||||
import core.stdc.stdint, std.string, std.c.string, std.c.stdlib, std.conv;
|
||||
import core.stdc.stdint, core.stdc.string, std.string, std.c.stdlib, std.conv;
|
||||
|
||||
import core.stdc.config;
|
||||
import core.time : dur, Duration;
|
||||
|
|
|
@ -3505,16 +3505,16 @@ Initialize with a message and an error code. */
|
|||
errno = e;
|
||||
version (Posix)
|
||||
{
|
||||
import std.c.string : strerror_r;
|
||||
import core.stdc.string : strerror_r;
|
||||
|
||||
char[256] buf = void;
|
||||
version (linux)
|
||||
{
|
||||
auto s = std.c.string.strerror_r(errno, buf.ptr, buf.length);
|
||||
auto s = core.stdc.string.strerror_r(errno, buf.ptr, buf.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
std.c.string.strerror_r(errno, buf.ptr, buf.length);
|
||||
core.stdc.string.strerror_r(errno, buf.ptr, buf.length);
|
||||
auto s = buf.ptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ deprecated("Please use std.windows.syserror.sysErrorString instead")
|
|||
class SysError
|
||||
{
|
||||
private import std.c.stdio;
|
||||
private import std.c.string;
|
||||
private import core.stdc.string;
|
||||
private import std.string;
|
||||
|
||||
static string msg(uint errcode)
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
module std.variant;
|
||||
|
||||
import std.c.string, std.conv, std.exception, std.traits, std.typecons,
|
||||
import core.stdc.string, std.conv, std.exception, std.traits, std.typecons,
|
||||
std.typetuple;
|
||||
|
||||
@trusted:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue