-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove PAL_Random and move palrt APIs into the minipal #108999
base: main
Are you sure you want to change the base?
Conversation
…the CoreCLR PAL to also use it. Also remove dangling references to DNCP and remove dead standalone-DNMD infra
… minipal implementation)
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
{ | ||
#endif // __cplusplus | ||
|
||
typedef struct minipal_guid__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
typedef struct minipal_guid__ | |
typedef struct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We get a slightly better experience in debuggers by giving a name to the struct instead of just naming the typedef (without the name on the struct, you just get "anonymous struct" which is a little annoying).
…l guid API instead of having three separate implementation of the exact same function body
* @param str The null-terminated UTF-16 string. | ||
* @return The length of the string. | ||
*/ | ||
size_t minipal_u16_strlen(const CHAR16_T* str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I must be missing something but why not use wcslen
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wcslen
doesn't work on non-Windows as wchar_t
on Unix platforms is 4-byte UTF-32, not 2-byte UTF-16.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just forward to wcslen
on Windows.
@@ -5,13 +5,11 @@ typedef char16_t WCHAR; | |||
|
|||
#include <dn-u16.h> | |||
#include <string.h> | |||
#include <minipal/strings.h> | |||
|
|||
size_t u16_strlen(const WCHAR* str) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be deleted and all callers switched to minipal_u16_strlen
?
Change usages of PAL_Random to instead use the minipal's random bytes APIs.
Move the remaining palrt APIs to the minipal to make them more easily usable outside of CoreCLR's PAL (and also to shrink the CoreCLR PAL). This work was spurred by #107961, where I realized that the set of Win32-like APIs that DNMD needs is equivalent to the set of Win32 API shims provided by palrt. To simplify things, I just decided to move the palrt implementations (with implementations that defer to the abstracted APIs on Windows) to the minipal and remove the palrt component.
Mostly extracted from #107961 when refactoring the new minipal APIs.