mirror of
https://github.com/python/cpython.git
synced 2025-08-29 21:25:01 +00:00
Add an optional size argument to _Py_char2wchar()
_Py_char2wchar() callers usually need the result size in characters. Since it's trivial to compute it in _Py_char2wchar() (O(1) whereas wcslen() is O(n)), add an option to get it.
This commit is contained in:
parent
0a1b8cba90
commit
168e117e0a
5 changed files with 26 additions and 17 deletions
|
@ -41,7 +41,7 @@ main(int argc, char **argv)
|
|||
oldloc = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, "");
|
||||
for (i = 0; i < argc; i++) {
|
||||
argv_copy[i] = _Py_char2wchar(argv[i]);
|
||||
argv_copy[i] = _Py_char2wchar(argv[i], NULL);
|
||||
if (!argv_copy[i])
|
||||
return 1;
|
||||
argv_copy2[i] = argv_copy[i];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue