forked from emscripten-core/emscripten
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore line in newlocale.c that was lost in emscripten-core#4813 (em…
…scripten-core#13584) When musl was last upgraded this malloc line removed from newlocale.c, perhaps by accident. This restores the behaviour of musl which is to allow `newlocale` with arbitrary names to succeed. I verified that this is the case using musl on my desktop. The reason that test_locale_wrong was passing prior to emscripten-core#4813 is that the musl older version of musl we were using prior to emscripten-core#4813 rejected all locales except for "C" and "POSIX". Upstream version that we are currently based on: https://github.com/emscripten-core/musl/blob/v1.1.15/src/locale/newlocale.c#L44 Upstream version of musl that we were previously using: https://github.com/emscripten-core/musl/blob/0b44a0315b47dd8eced9f3b7f31580cf14bbfc01/src/locale/newlocale.c#L5
- Loading branch information
Showing
10 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <locale.h> | ||
#include <stdio.h> | ||
|
||
void test(const char* name) { | ||
locale_t loc = newlocale(LC_ALL_MASK, name, 0); | ||
if (loc) | ||
printf("newlocale '%s' succeeded\n", name); | ||
else | ||
printf("newlocale '%s' failed\n", name); | ||
} | ||
|
||
int main(int argc, char* argv[]) { | ||
test("C"); | ||
test("waka"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
newlocale 'C' succeeded | ||
newlocale 'waka' succeeded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <stdio.h> | ||
#include <locale.h> | ||
|
||
int main(int argc, char* argv[]) { | ||
char* rtn; | ||
rtn = setlocale(LC_ALL, "C"); | ||
printf("done setlocale 'C': '%s'\n", rtn); | ||
rtn = setlocale(LC_ALL, "waka"); | ||
printf("done setlocale 'waka': '%s'\n", rtn); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
done setlocale 'C': 'C;C;C;C;C;C' | ||
done setlocale 'waka': 'waka;waka;waka;waka;waka;waka' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters