We want to replace NSPR functions with standard C functions if they available on all platforms. This bug is probably not a good-first-bug because there are some special cases to consider. 1. Replace PL_strdup() calls with strdup() in C++ .h and .cpp files: http://searchfox.org/mozilla-central/search?q=symbol%3A_Z9PL_strdup&path=.h%24 http://searchfox.org/mozilla-central/search?q=symbol%3A_Z9PL_strdup&path=.cpp%24 *** CAUTION: PL_strdup(nullptr) will return "", but strdup(nullptr) will crash! Any calls to PL_strdup() that are changed to strdup() should be audited to see if they might need to handle a null pointer, with code like `strdup(str ? str : "")` or maybe returning an error. 2. Replace PL_strfree() calls with free(): http://searchfox.org/mozilla-central/search?q=symbol%3A_Z10PL_strfree&path=.cpp%24 3. Add #include <string.h> if it's needed for strdup()'s function declaration. 4. Remove #include "plstr.h" if it's no longer needed for other NSPR string function declarations.
Bug 1308094 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
We want to replace NSPR functions with standard C functions if they available on all platforms. This bug is probably not a good-first-bug because there are some special cases to consider. 1. Replace `PL_strdup()` calls with `strdup()` outside of `nsprpub/` and `security/nss` code: https://searchfox.org/mozilla-central/search?q=PL_strdup&path=.cpp%24&case=false®exp=false *** CAUTION: `PL_strdup(nullptr)` will return "", but `strdup(nullptr)` will crash! Any calls to `PL_strdup()` that are changed to `strdup()` should be carefully audited to see if they might need to handle a null pointer, with code like `strdup(str ? str : "")` or maybe returning an error. 2. Replace `PL_strfree()` calls with `free()`: https://searchfox.org/mozilla-central/search?q=PL_strfree&path=.cpp%24&case=false®exp=false 3. Add `#include <string.h>` if it's needed for `strdup()`'s function declaration. 4. Remove `#include "plstr.h"` if it's no longer needed for other NSPR string function declarations.
We want to replace NSPR functions with standard C functions if they available on all platforms. This bug is probably not a good-first-bug because there are some special cases to consider. 1. Replace PL_strdup() calls with strdup() outside of nsprpub/ and security/nss code: https://searchfox.org/mozilla-central/search?q=PL_strdup&path=.cpp%24&case=false®exp=false *** CAUTION: PL_strdup(nullptr) will return "", but strdup(nullptr) will crash! Any calls to PL_strdup() that are changed to strdup() should be carefully audited to see if they might need to handle a null pointer, with code like strdup(str ? str : "") or maybe returning an error. 2. Replace PL_strfree() calls with free(): https://searchfox.org/mozilla-central/search?q=PL_strfree&path=.cpp%24&case=false®exp=false 3. Add #include <string.h> if it's needed for strdup()'s function declaration. 4. Remove #include "plstr.h" if it's no longer needed for other NSPR string function declarations.