Closed Bug 129773 Opened 23 years ago Closed 22 years ago

strdup() should be made usable on all platforms

Categories

(Core :: XPCOM, defect)

PowerPC
Mac System 9.x
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: dmosedale, Assigned: jag+mozilla)

Details

(Keywords: perf)

Right now, one must #include <macstdlibextras.h> in order to get the strdup() prototype on Mac, which has the consequence that it's a hassle to use strdup() in XP code. Since some platform libc implementations are likely to provide good, hand-optimized implementations of this, we're probably missing out on a performance win. We should have one of the core XPCOM or string headers include this header all the time on MacOS 9 (at least) so that we everybody can use strdup() easily.
Keywords: perf
I would suggest one of the core XPCOM files, since you may want strdup without wanting them newfangled strings :-)
what does core xpcom have to do with string duplication? :-)
Well, we could use nsCRT::strdup still, but have that #ifdef HAVE_STRDUP. As an inline funcion, you should still get the compiler builtin benefits, and you'd call PL_strdup in other cases. You'd have to advertise that strdup won't do the hand-holding null checks for you, but we shouldn't be relying on those anyway. I don't think we should object using nsCRT::* for functions which aren't part of the standard, and so require separate implementations. We're going to have to keep it for all the prunichar functions anyway, and do a similar thing for 2-byte native prunichar platforms which can use wcslen and friends.
giving up ancient string bugs to the new string owner. jag, you'll want to sort through these and see which ones still apply and go with or against the direction in which you intend strings evolve
Assignee: scc → jaggernaut
This bug is targeted at a Mac classic platform/OS, which is no longer supported by mozilla.org. Please re-target it to another platform/OS if this bug applies there as well or resolve this bug. I will resolve this bug as WONTFIX in four weeks if no action has been taken. To filter this and similar messages out, please filter for "mac_cla_reorg".
OS 9 is dead.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → WONTFIX
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.