Skip to content

Commit

Permalink
Merge pull request #8509 from Geod24/preview-in-extern
Browse files Browse the repository at this point in the history
Remove uses of 'in' on extern(C) functions

Signed-off-by: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Merged-on-behalf-of: Mathias LANG <pro.mathias.lang@gmail.com>
  • Loading branch information
dlang-bot authored Jul 18, 2022
2 parents 4c1354e + 0295395 commit 258c64b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
16 changes: 8 additions & 8 deletions etc/c/curl.d
Original file line number Diff line number Diff line change
Expand Up @@ -1372,9 +1372,9 @@ alias curl_TimeCond = int;
/** curl_strequal() and curl_strnequal() are subject for removal in a future
libcurl, see lib/README.curlx for details */
extern (C) {
int curl_strequal(in const(char) *s1, in const(char) *s2);
int curl_strequal(scope const(char) *s1, scope const(char) *s2);
/// ditto
int curl_strnequal(in const(char) *s1, in const(char) *s2, size_t n);
int curl_strnequal(scope const(char) *s1, scope const(char) *s2, size_t n);
}
enum CurlForm {
nothing, /********** the first one is unused ************/
Expand Down Expand Up @@ -1464,7 +1464,7 @@ CURLFORMcode curl_formadd(curl_httppost **httppost, curl_httppost **last_post,.
* Should return the buffer length passed to it as the argument "len" on
* success.
*/
alias curl_formget_callback = size_t function(void *arg, in const(char) *buf, size_t len);
alias curl_formget_callback = size_t function(void *arg, const(char) *buf, size_t len);

/**
* Name: curl_formget()
Expand Down Expand Up @@ -1514,10 +1514,10 @@ char * curl_version();
* %XX versions). This function returns a new allocated string or NULL if an
* error occurred.
*/
char * curl_easy_escape(CURL *handle, in const(char) *string, int length);
char * curl_easy_escape(CURL *handle, scope const(char) *string, int length);

/** the previous version: */
char * curl_escape(in const(char) *string, int length);
char * curl_escape(scope const(char) *string, int length);


/**
Expand All @@ -1531,10 +1531,10 @@ char * curl_escape(in const(char) *string, int length);
* Conversion Note: On non-ASCII platforms the ASCII %XX codes are
* converted into the host encoding.
*/
char * curl_easy_unescape(CURL *handle, in const(char) *string, int length, int *outlength);
char * curl_easy_unescape(CURL *handle, scope const(char) *string, int length, int *outlength);

/** the previous version */
char * curl_unescape(in const(char) *string, int length);
char * curl_unescape(scope const(char) *string, int length);

/**
* Name: curl_free()
Expand Down Expand Up @@ -1608,7 +1608,7 @@ struct curl_slist
* Appends a string to a linked list. If no list exists, it will be created
* first. Returns the new list, after appending.
*/
curl_slist * curl_slist_append(curl_slist *, in const(char) *);
curl_slist * curl_slist_append(curl_slist *, const(char) *);

/**
* Name: curl_slist_free_all()
Expand Down
2 changes: 1 addition & 1 deletion posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ dscanner: $(LIB)
@# However, we still need to ensure that the DScanner binary is built once
@[ -f $(DSCANNER_DIR)/dsc ] || ${MAKE} -f posix.mak $(DSCANNER_DIR)/dsc
@echo "Running DScanner"
$(DSCANNER_DIR)/dsc --config .dscanner.ini --styleCheck etc std -I.
$(DSCANNER_DIR)/dsc --config .dscanner.ini -I $(DRUNTIME_PATH)/src/ --styleCheck etc std -I.

style_lint_shellcmds:
@echo "Check for trailing whitespace"
Expand Down
10 changes: 3 additions & 7 deletions std/typecons.d
Original file line number Diff line number Diff line change
Expand Up @@ -6595,15 +6595,11 @@ if (!is(T == class) && !(is(T == interface)))
private enum enableGCScan = hasIndirections!T;
}

// TODO remove pure when https://issues.dlang.org/show_bug.cgi?id=15862 has been fixed
extern(C) private pure nothrow @nogc static
{
pragma(mangle, "free") void pureFree( void *ptr );
static if (enableGCScan)
{
pragma(mangle, "gc_addRange") void pureGcAddRange( in void* p, size_t sz, const TypeInfo ti = null );
pragma(mangle, "gc_removeRange") void pureGcRemoveRange( in void* p );
}
import core.memory : GC;
}

/// `RefCounted` storage implementation.
Expand Down Expand Up @@ -6643,7 +6639,7 @@ if (!is(T == class) && !(is(T == interface)))
{
import std.internal.memory : enforceCalloc;
_store = cast(Impl*) enforceCalloc(1, Impl.sizeof);
pureGcAddRange(&_store._payload, T.sizeof);
GC.addRange(&_store._payload, T.sizeof);
}
else
{
Expand All @@ -6656,7 +6652,7 @@ if (!is(T == class) && !(is(T == interface)))
{
static if (enableGCScan)
{
pureGcRemoveRange(&this._store._payload);
GC.removeRange(&this._store._payload);
}
pureFree(_store);
_store = null;
Expand Down

0 comments on commit 258c64b

Please sign in to comment.