-
Notifications
You must be signed in to change notification settings - Fork 143
Description
The documentation for strpool_length() says this:
Returns the length, in characters, of the specified string. The resulting value is only valid as long as no call is made
tostrpool_init,strpool_term,strpool_defragorstrpool_discard. It is therefor recommended to never store the
value, and always grab it fresh by another call tostrpool_lengthwhen it is needed.strpool_lengthis a very fast
function to call - it does little more than an array lookup. Ifhandleis invalid,strpool_lengthreturns 0.
Why would the length not stay valid even after a call to strpool_defrag()? The string still exists, it's just that its location in memory may have changed. So is the documentation accurate?
Another nitpick, wouldn't it be better to say that this returns the length in bytes, not characters? I don't think strpool is doing any kind of UTF8 decoding.