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

Commit ae24725

Browse files
authored
Merge pull request #2598 from ErnyTech/add-memmem
Add memmem to core.sys merged-on-behalf-of: Petar Kirov <[email protected]>
2 parents ca8e728 + b282975 commit ae24725

File tree

11 files changed

+213
-0
lines changed

11 files changed

+213
-0
lines changed

mak/COPY

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,13 @@ COPY=\
6767
\
6868
$(IMPDIR)\core\sync\event.d \
6969
\
70+
$(IMPDIR)\core\sys\bionic\string.d \
71+
\
7072
$(IMPDIR)\core\sys\darwin\crt_externs.d \
7173
$(IMPDIR)\core\sys\darwin\dlfcn.d \
7274
$(IMPDIR)\core\sys\darwin\execinfo.d \
7375
$(IMPDIR)\core\sys\darwin\pthread.d \
76+
$(IMPDIR)\core\sys\darwin\string.d \
7477
\
7578
$(IMPDIR)\core\sys\darwin\mach\dyld.d \
7679
$(IMPDIR)\core\sys\darwin\mach\getsect.d \
@@ -92,6 +95,7 @@ COPY=\
9295
$(IMPDIR)\core\sys\freebsd\netinet\in_.d \
9396
\
9497
$(IMPDIR)\core\sys\freebsd\pthread_np.d \
98+
$(IMPDIR)\core\sys\freebsd\string.d \
9599
$(IMPDIR)\core\sys\freebsd\sys\_bitset.d \
96100
$(IMPDIR)\core\sys\freebsd\sys\_cpuset.d \
97101
$(IMPDIR)\core\sys\freebsd\sys\cdefs.d \
@@ -112,6 +116,7 @@ COPY=\
112116
$(IMPDIR)\core\sys\dragonflybsd\netinet\in_.d \
113117
\
114118
$(IMPDIR)\core\sys\dragonflybsd\pthread_np.d \
119+
$(IMPDIR)\core\sys\dragonflybsd\string.d \
115120
$(IMPDIR)\core\sys\dragonflybsd\sys\_bitset.d \
116121
$(IMPDIR)\core\sys\dragonflybsd\sys\_cpuset.d \
117122
$(IMPDIR)\core\sys\dragonflybsd\sys\cdefs.d \
@@ -134,6 +139,7 @@ COPY=\
134139
$(IMPDIR)\core\sys\linux\ifaddrs.d \
135140
$(IMPDIR)\core\sys\linux\link.d \
136141
$(IMPDIR)\core\sys\linux\sched.d \
142+
$(IMPDIR)\core\sys\linux\string.d \
137143
$(IMPDIR)\core\sys\linux\termios.d \
138144
$(IMPDIR)\core\sys\linux\time.d \
139145
$(IMPDIR)\core\sys\linux\timerfd.d \
@@ -156,7 +162,11 @@ COPY=\
156162
$(IMPDIR)\core\sys\linux\sys\time.d \
157163
$(IMPDIR)\core\sys\linux\sys\prctl.d \
158164
\
165+
$(IMPDIR)\core\sys\netbsd\sys\featuretest.d \
166+
$(IMPDIR)\core\sys\netbsd\string.d \
167+
\
159168
$(IMPDIR)\core\sys\openbsd\dlfcn.d \
169+
$(IMPDIR)\core\sys\openbsd\string.d \
160170
\
161171
$(IMPDIR)\core\sys\posix\arpa\inet.d \
162172
$(IMPDIR)\core\sys\posix\aio.d \

mak/SRCS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,13 @@ SRCS=\
7373
src\core\sync\rwmutex.d \
7474
src\core\sync\semaphore.d \
7575
\
76+
src\core\sys\bionic\string.d \
77+
\
7678
src\core\sys\darwin\crt_externs.d \
7779
src\core\sys\darwin\dlfcn.d \
7880
src\core\sys\darwin\execinfo.d \
7981
src\core\sys\darwin\pthread.d \
82+
src\core\sys\darwin\string.d \
8083
src\core\sys\darwin\mach\dyld.d \
8184
src\core\sys\darwin\mach\getsect.d \
8285
src\core\sys\darwin\mach\kern_return.d \
@@ -94,6 +97,7 @@ SRCS=\
9497
src\core\sys\freebsd\execinfo.d \
9598
src\core\sys\freebsd\netinet\in_.d \
9699
src\core\sys\freebsd\pthread_np.d \
100+
src\core\sys\freebsd\string.d \
97101
src\core\sys\freebsd\sys\_bitset.d \
98102
src\core\sys\freebsd\sys\_cpuset.d \
99103
src\core\sys\freebsd\sys\cdefs.d \
@@ -112,6 +116,7 @@ SRCS=\
112116
src\core\sys\dragonflybsd\execinfo.d \
113117
src\core\sys\dragonflybsd\netinet\in_.d \
114118
src\core\sys\dragonflybsd\pthread_np.d \
119+
src\core\sys\dragonflybsd\string.d \
115120
src\core\sys\dragonflybsd\sys\_bitset.d \
116121
src\core\sys\dragonflybsd\sys\_cpuset.d \
117122
src\core\sys\dragonflybsd\sys\cdefs.d \
@@ -134,6 +139,7 @@ SRCS=\
134139
src\core\sys\linux\ifaddrs.d \
135140
src\core\sys\linux\link.d \
136141
src\core\sys\linux\sched.d \
142+
src\core\sys\linux\string.d \
137143
src\core\sys\linux\termios.d \
138144
src\core\sys\linux\time.d \
139145
src\core\sys\linux\timerfd.d \
@@ -156,7 +162,11 @@ SRCS=\
156162
src\core\sys\linux\sys\time.d \
157163
src\core\sys\linux\sys\prctl.d \
158164
\
165+
src\core\sys\netbsd\sys\featuretest.d \
166+
src\core\sys\netbsd\string.d \
167+
\
159168
src\core\sys\openbsd\dlfcn.d \
169+
src\core\sys\openbsd\string.d \
160170
\
161171
src\core\sys\posix\arpa\inet.d \
162172
src\core\sys\posix\aio.d \

mak/WINDOWS

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ copydir: $(IMPDIR)
3434
mkdir $(IMPDIR)\core\stdc
3535
mkdir $(IMPDIR)\core\stdcpp
3636
mkdir $(IMPDIR)\core\internal
37+
mkdir $(IMPDIR)\core\sys\bionic
3738
mkdir $(IMPDIR)\core\sys\darwin\mach
3839
mkdir $(IMPDIR)\core\sys\darwin\netinet
3940
mkdir $(IMPDIR)\core\sys\darwin\sys
@@ -44,6 +45,8 @@ copydir: $(IMPDIR)
4445
mkdir $(IMPDIR)\core\sys\linux\netinet
4546
mkdir $(IMPDIR)\core\sys\linux\sys
4647
mkdir $(IMPDIR)\core\sys\linux\sys\netinet
48+
mkdir src\core\sys\netbsd\sys
49+
mkdir src\core\sys\netbsd\
4750
mkdir $(IMPDIR)\core\sys\openbsd
4851
mkdir $(IMPDIR)\core\sys\posix\arpa
4952
mkdir $(IMPDIR)\core\sys\posix\net
@@ -239,6 +242,9 @@ $(IMPDIR)\core\stdcpp\type_traits.d : src\core\stdcpp\type_traits.d
239242
$(IMPDIR)\core\stdcpp\xutility.d : src\core\stdcpp\xutility.d
240243
copy $** $@
241244

245+
$(IMPDIR)\core\sys\bionic\string.d : src\core\sys\bionic\string.d
246+
copy $** $@
247+
242248
$(IMPDIR)\core\sys\darwin\crt_externs.d : src\core\sys\darwin\crt_externs.d
243249
copy $** $@
244250

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

260+
$(IMPDIR)\core\sys\darwin\string.d : src\core\sys\darwin\string.d
261+
copy $** $@
262+
254263
$(IMPDIR)\core\sys\darwin\mach\dyld.d : src\core\sys\darwin\mach\dyld.d
255264
copy $** $@
256265

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

305+
$(IMPDIR)\core\sys\freebsd\string.d : src\core\sys\freebsd\string.d
306+
copy $** $@
307+
296308
$(IMPDIR)\core\sys\freebsd\time.d : src\core\sys\freebsd\time.d
297309
copy $** $@
298310

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

359+
$(IMPDIR)\core\sys\dragonflybsd\string.d : src\core\sys\dragonflybsd\string.d
360+
copy $** $@
361+
347362
$(IMPDIR)\core\sys\dragonflybsd\time.d : src\core\sys\dragonflybsd\time.d
348363
copy $** $@
349364

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

428+
$(IMPDIR)\core\sys\linux\string.d : src\core\sys\linux\string.d
429+
copy $** $@
430+
413431
$(IMPDIR)\core\sys\linux\termios.d : src\core\sys\linux\termios.d
414432
copy $** $@
415433

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

488+
$(IMPDIR)\core\sys\netbsd\sys\featuretest.d : src\core\sys\netbsd\sys\featuretest.d
489+
copy $** $@
490+
491+
$(IMPDIR)\core\sys\netbsd\string.d : src\core\sys\netbsd\string.d
492+
copy $** $@
493+
470494
$(IMPDIR)\core\sys\openbsd\dlfcn.d : src\core\sys\openbsd\dlfcn.d
471495
copy $** $@
472496

497+
$(IMPDIR)\core\sys\openbsd\string.d : src\core\sys\openbsd\string.d
498+
copy $** $@
499+
473500
$(IMPDIR)\core\sys\posix\arpa\inet.d : src\core\sys\posix\arpa\inet.d
474501
copy $** $@
475502

src/core/sys/bionic/string.d

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* D header file for Bionic string.
3+
*
4+
* Copyright: Copyright © 2019, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Ernesto Castellotti
7+
*/
8+
module core.sys.bionic.string;
9+
10+
public import core.stdc.string;
11+
12+
version (CRuntime_Bionic):
13+
extern (C):
14+
nothrow:
15+
@nogc:
16+
17+
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);

src/core/sys/darwin/string.d

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* D header file for Darwin string.
3+
*
4+
* Copyright: Copyright © 2019, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Ernesto Castellotti
7+
*/
8+
module core.sys.darwin.string;
9+
10+
public import core.stdc.string;
11+
import core.sys.darwin.sys.cdefs;
12+
13+
version (OSX)
14+
version = Darwin;
15+
else version (iOS)
16+
version = Darwin;
17+
else version (TVOS)
18+
version = Darwin;
19+
else version (WatchOS)
20+
version = Darwin;
21+
22+
version (Darwin):
23+
extern (C):
24+
nothrow:
25+
@nogc:
26+
27+
static if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL)
28+
{
29+
// ^ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
30+
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
31+
}

src/core/sys/dragonflybsd/string.d

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* D header file for DragonFlyBSD string.
3+
*
4+
* Copyright: Copyright © 2019, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Ernesto Castellotti
7+
*/
8+
module core.sys.dragonflybsd.string;
9+
10+
public import core.stdc.string;
11+
import core.sys.dragonflybsd.sys.cdefs;
12+
13+
version (DragonFlyBSD):
14+
extern (C):
15+
nothrow:
16+
@nogc:
17+
18+
static if (__BSD_VISIBLE)
19+
{
20+
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
21+
}
22+

src/core/sys/freebsd/string.d

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* D header file for FreeBSD string.
3+
*
4+
* Copyright: Copyright © 2019, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Ernesto Castellotti
7+
*/
8+
module core.sys.freebsd.string;
9+
10+
public import core.stdc.string;
11+
import core.sys.freebsd.sys.cdefs;
12+
13+
version (FreeBSD):
14+
extern (C):
15+
nothrow:
16+
@nogc:
17+
18+
static if (__BSD_VISIBLE)
19+
{
20+
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
21+
}

src/core/sys/linux/string.d

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* D header file for Linux string.
3+
*
4+
* Copyright: Copyright © 2019, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Ernesto Castellotti
7+
*/
8+
module core.sys.linux.string;
9+
10+
public import core.stdc.string;
11+
import core.sys.linux.config;
12+
13+
version (linux):
14+
extern (C):
15+
nothrow:
16+
@nogc:
17+
18+
static if (__USE_GNU)
19+
{
20+
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
21+
}

src/core/sys/netbsd/string.d

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* D header file for NetBSD string.
3+
*
4+
* Copyright: Copyright © 2019, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Ernesto Castellotti
7+
*/
8+
module core.sys.netbsd.string;
9+
10+
public import core.stdc.string;
11+
import core.sys.netbsd.sys.featuretest;
12+
13+
version (NetBSD):
14+
extern (C):
15+
nothrow:
16+
@nogc:
17+
18+
static if (_NETBSD_SOURCE)
19+
{
20+
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
21+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* D header file for NetBSD featuretest;.
3+
*
4+
* Copyright: Copyright © 2019, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Ernesto Castellotti
7+
*/
8+
module core.sys.netbsd.sys.featuretest;
9+
10+
version (NetBSD):
11+
12+
enum _NETBSD_SOURCE = true;

0 commit comments

Comments
 (0)