Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2598 from ErnyTech/add-memmem
Browse files Browse the repository at this point in the history
Add memmem to core.sys
merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
  • Loading branch information
dlang-bot authored May 6, 2019
2 parents ca8e728 + b282975 commit ae24725
Show file tree
Hide file tree
Showing 11 changed files with 213 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mak/COPY
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ COPY=\
\
$(IMPDIR)\core\sync\event.d \
\
$(IMPDIR)\core\sys\bionic\string.d \
\
$(IMPDIR)\core\sys\darwin\crt_externs.d \
$(IMPDIR)\core\sys\darwin\dlfcn.d \
$(IMPDIR)\core\sys\darwin\execinfo.d \
$(IMPDIR)\core\sys\darwin\pthread.d \
$(IMPDIR)\core\sys\darwin\string.d \
\
$(IMPDIR)\core\sys\darwin\mach\dyld.d \
$(IMPDIR)\core\sys\darwin\mach\getsect.d \
Expand All @@ -92,6 +95,7 @@ COPY=\
$(IMPDIR)\core\sys\freebsd\netinet\in_.d \
\
$(IMPDIR)\core\sys\freebsd\pthread_np.d \
$(IMPDIR)\core\sys\freebsd\string.d \
$(IMPDIR)\core\sys\freebsd\sys\_bitset.d \
$(IMPDIR)\core\sys\freebsd\sys\_cpuset.d \
$(IMPDIR)\core\sys\freebsd\sys\cdefs.d \
Expand All @@ -112,6 +116,7 @@ COPY=\
$(IMPDIR)\core\sys\dragonflybsd\netinet\in_.d \
\
$(IMPDIR)\core\sys\dragonflybsd\pthread_np.d \
$(IMPDIR)\core\sys\dragonflybsd\string.d \
$(IMPDIR)\core\sys\dragonflybsd\sys\_bitset.d \
$(IMPDIR)\core\sys\dragonflybsd\sys\_cpuset.d \
$(IMPDIR)\core\sys\dragonflybsd\sys\cdefs.d \
Expand All @@ -134,6 +139,7 @@ COPY=\
$(IMPDIR)\core\sys\linux\ifaddrs.d \
$(IMPDIR)\core\sys\linux\link.d \
$(IMPDIR)\core\sys\linux\sched.d \
$(IMPDIR)\core\sys\linux\string.d \
$(IMPDIR)\core\sys\linux\termios.d \
$(IMPDIR)\core\sys\linux\time.d \
$(IMPDIR)\core\sys\linux\timerfd.d \
Expand All @@ -156,7 +162,11 @@ COPY=\
$(IMPDIR)\core\sys\linux\sys\time.d \
$(IMPDIR)\core\sys\linux\sys\prctl.d \
\
$(IMPDIR)\core\sys\netbsd\sys\featuretest.d \
$(IMPDIR)\core\sys\netbsd\string.d \
\
$(IMPDIR)\core\sys\openbsd\dlfcn.d \
$(IMPDIR)\core\sys\openbsd\string.d \
\
$(IMPDIR)\core\sys\posix\arpa\inet.d \
$(IMPDIR)\core\sys\posix\aio.d \
Expand Down
10 changes: 10 additions & 0 deletions mak/SRCS
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ SRCS=\
src\core\sync\rwmutex.d \
src\core\sync\semaphore.d \
\
src\core\sys\bionic\string.d \
\
src\core\sys\darwin\crt_externs.d \
src\core\sys\darwin\dlfcn.d \
src\core\sys\darwin\execinfo.d \
src\core\sys\darwin\pthread.d \
src\core\sys\darwin\string.d \
src\core\sys\darwin\mach\dyld.d \
src\core\sys\darwin\mach\getsect.d \
src\core\sys\darwin\mach\kern_return.d \
Expand All @@ -94,6 +97,7 @@ SRCS=\
src\core\sys\freebsd\execinfo.d \
src\core\sys\freebsd\netinet\in_.d \
src\core\sys\freebsd\pthread_np.d \
src\core\sys\freebsd\string.d \
src\core\sys\freebsd\sys\_bitset.d \
src\core\sys\freebsd\sys\_cpuset.d \
src\core\sys\freebsd\sys\cdefs.d \
Expand All @@ -112,6 +116,7 @@ SRCS=\
src\core\sys\dragonflybsd\execinfo.d \
src\core\sys\dragonflybsd\netinet\in_.d \
src\core\sys\dragonflybsd\pthread_np.d \
src\core\sys\dragonflybsd\string.d \
src\core\sys\dragonflybsd\sys\_bitset.d \
src\core\sys\dragonflybsd\sys\_cpuset.d \
src\core\sys\dragonflybsd\sys\cdefs.d \
Expand All @@ -134,6 +139,7 @@ SRCS=\
src\core\sys\linux\ifaddrs.d \
src\core\sys\linux\link.d \
src\core\sys\linux\sched.d \
src\core\sys\linux\string.d \
src\core\sys\linux\termios.d \
src\core\sys\linux\time.d \
src\core\sys\linux\timerfd.d \
Expand All @@ -156,7 +162,11 @@ SRCS=\
src\core\sys\linux\sys\time.d \
src\core\sys\linux\sys\prctl.d \
\
src\core\sys\netbsd\sys\featuretest.d \
src\core\sys\netbsd\string.d \
\
src\core\sys\openbsd\dlfcn.d \
src\core\sys\openbsd\string.d \
\
src\core\sys\posix\arpa\inet.d \
src\core\sys\posix\aio.d \
Expand Down
27 changes: 27 additions & 0 deletions mak/WINDOWS
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ copydir: $(IMPDIR)
mkdir $(IMPDIR)\core\stdc
mkdir $(IMPDIR)\core\stdcpp
mkdir $(IMPDIR)\core\internal
mkdir $(IMPDIR)\core\sys\bionic
mkdir $(IMPDIR)\core\sys\darwin\mach
mkdir $(IMPDIR)\core\sys\darwin\netinet
mkdir $(IMPDIR)\core\sys\darwin\sys
Expand All @@ -44,6 +45,8 @@ copydir: $(IMPDIR)
mkdir $(IMPDIR)\core\sys\linux\netinet
mkdir $(IMPDIR)\core\sys\linux\sys
mkdir $(IMPDIR)\core\sys\linux\sys\netinet
mkdir src\core\sys\netbsd\sys
mkdir src\core\sys\netbsd\
mkdir $(IMPDIR)\core\sys\openbsd
mkdir $(IMPDIR)\core\sys\posix\arpa
mkdir $(IMPDIR)\core\sys\posix\net
Expand Down Expand Up @@ -239,6 +242,9 @@ $(IMPDIR)\core\stdcpp\type_traits.d : src\core\stdcpp\type_traits.d
$(IMPDIR)\core\stdcpp\xutility.d : src\core\stdcpp\xutility.d
copy $** $@

$(IMPDIR)\core\sys\bionic\string.d : src\core\sys\bionic\string.d
copy $** $@

$(IMPDIR)\core\sys\darwin\crt_externs.d : src\core\sys\darwin\crt_externs.d
copy $** $@

Expand All @@ -251,6 +257,9 @@ $(IMPDIR)\core\sys\darwin\execinfo.d : src\core\sys\darwin\execinfo.d
$(IMPDIR)\core\sys\darwin\pthread.d : src\core\sys\darwin\pthread.d
copy $** $@

$(IMPDIR)\core\sys\darwin\string.d : src\core\sys\darwin\string.d
copy $** $@

$(IMPDIR)\core\sys\darwin\mach\dyld.d : src\core\sys\darwin\mach\dyld.d
copy $** $@

Expand Down Expand Up @@ -293,6 +302,9 @@ $(IMPDIR)\core\sys\freebsd\execinfo.d : src\core\sys\freebsd\execinfo.d
$(IMPDIR)\core\sys\freebsd\pthread_np.d : src\core\sys\freebsd\pthread_np.d
copy $** $@

$(IMPDIR)\core\sys\freebsd\string.d : src\core\sys\freebsd\string.d
copy $** $@

$(IMPDIR)\core\sys\freebsd\time.d : src\core\sys\freebsd\time.d
copy $** $@

Expand Down Expand Up @@ -344,6 +356,9 @@ $(IMPDIR)\core\sys\dragonflybsd\execinfo.d : src\core\sys\dragonflybsd\execinfo.
$(IMPDIR)\core\sys\dragonflybsd\pthread_np.d : src\core\sys\dragonflybsd\pthread_np.d
copy $** $@

$(IMPDIR)\core\sys\dragonflybsd\string.d : src\core\sys\dragonflybsd\string.d
copy $** $@

$(IMPDIR)\core\sys\dragonflybsd\time.d : src\core\sys\dragonflybsd\time.d
copy $** $@

Expand Down Expand Up @@ -410,6 +425,9 @@ $(IMPDIR)\core\sys\linux\link.d : src\core\sys\linux\link.d
$(IMPDIR)\core\sys\linux\sched.d : src\core\sys\linux\sched.d
copy $** $@

$(IMPDIR)\core\sys\linux\string.d : src\core\sys\linux\string.d
copy $** $@

$(IMPDIR)\core\sys\linux\termios.d : src\core\sys\linux\termios.d
copy $** $@

Expand Down Expand Up @@ -467,9 +485,18 @@ $(IMPDIR)\core\sys\linux\sys\xattr.d : src\core\sys\linux\sys\xattr.d
$(IMPDIR)\core\sys\linux\sys\time.d : src\core\sys\linux\sys\time.d
copy $** $@

$(IMPDIR)\core\sys\netbsd\sys\featuretest.d : src\core\sys\netbsd\sys\featuretest.d
copy $** $@

$(IMPDIR)\core\sys\netbsd\string.d : src\core\sys\netbsd\string.d
copy $** $@

$(IMPDIR)\core\sys\openbsd\dlfcn.d : src\core\sys\openbsd\dlfcn.d
copy $** $@

$(IMPDIR)\core\sys\openbsd\string.d : src\core\sys\openbsd\string.d
copy $** $@

$(IMPDIR)\core\sys\posix\arpa\inet.d : src\core\sys\posix\arpa\inet.d
copy $** $@

Expand Down
17 changes: 17 additions & 0 deletions src/core/sys/bionic/string.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* D header file for Bionic string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.bionic.string;

public import core.stdc.string;

version (CRuntime_Bionic):
extern (C):
nothrow:
@nogc:

pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
31 changes: 31 additions & 0 deletions src/core/sys/darwin/string.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* D header file for Darwin string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.darwin.string;

public import core.stdc.string;
import core.sys.darwin.sys.cdefs;

version (OSX)
version = Darwin;
else version (iOS)
version = Darwin;
else version (TVOS)
version = Darwin;
else version (WatchOS)
version = Darwin;

version (Darwin):
extern (C):
nothrow:
@nogc:

static if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL)
{
// ^ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
22 changes: 22 additions & 0 deletions src/core/sys/dragonflybsd/string.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* D header file for DragonFlyBSD string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.dragonflybsd.string;

public import core.stdc.string;
import core.sys.dragonflybsd.sys.cdefs;

version (DragonFlyBSD):
extern (C):
nothrow:
@nogc:

static if (__BSD_VISIBLE)
{
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}

21 changes: 21 additions & 0 deletions src/core/sys/freebsd/string.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* D header file for FreeBSD string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.freebsd.string;

public import core.stdc.string;
import core.sys.freebsd.sys.cdefs;

version (FreeBSD):
extern (C):
nothrow:
@nogc:

static if (__BSD_VISIBLE)
{
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
21 changes: 21 additions & 0 deletions src/core/sys/linux/string.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* D header file for Linux string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.linux.string;

public import core.stdc.string;
import core.sys.linux.config;

version (linux):
extern (C):
nothrow:
@nogc:

static if (__USE_GNU)
{
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
21 changes: 21 additions & 0 deletions src/core/sys/netbsd/string.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* D header file for NetBSD string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.netbsd.string;

public import core.stdc.string;
import core.sys.netbsd.sys.featuretest;

version (NetBSD):
extern (C):
nothrow:
@nogc:

static if (_NETBSD_SOURCE)
{
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
12 changes: 12 additions & 0 deletions src/core/sys/netbsd/sys/featuretest.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* D header file for NetBSD featuretest;.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.netbsd.sys.featuretest;

version (NetBSD):

enum _NETBSD_SOURCE = true;
21 changes: 21 additions & 0 deletions src/core/sys/openbsd/string.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* D header file for OpenBSD string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.openbsd.string;

public import core.stdc.string;
import core.sys.openbsd.sys.cdefs;

version (OpenBSD):
extern (C):
nothrow:
@nogc:

static if (__BSD_VISIBLE)
{
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}

0 comments on commit ae24725

Please sign in to comment.