[DGD] Re: status
Erwin Harte
harte at is-here.com
Wed Jan 7 19:49:00 CET 2004
On Wed, Jan 07, 2004 at 06:32:54PM +0000, Robert Forshaw wrote:
> >From: Erwin Harte <harte at is-here.com>
> >I think you want to look into sscanf() to replace
> >seek_and_return_string().
>
> I was initially using sscanf, but its a rather expensive function, and
> seek_and_return_string() is simpler because I don't have to declare more
> variables...
<mode type="6 year old kid">Is not!</mode>
Why do you assume sscanf() is a 'rather expensive function' when it's
implemented in C whereas your own code runs in interpreted LPC?
This is how I'd implement your find_object() function:
static nomask
find_object(mixed obj, int master)
{
if (master) {
if (typeof(obj) == T_OBJECT) {
obj = object_name(obj);
}
/*
* Strip possible #<number> part; if no match
* is found obj will still contain original
* value after the sscanf()!
*/
sscanf(obj, "%s#", obj);
return ::find_object(obj);
}
if (typeof(obj) == T_STRING) {
return ::find_object(obj);
}
return obj;
}
[...O_INDEX...]
> An identifier for the code? No sorry, I don't understand. I take it this
> isn't suited to my current problem then?
No, I don't think this will help you implement your find_object()
function more efficiently.
Cheers,
Erwin.
--
Erwin Harte <harte at is-here.com>
_________________________________________________________________
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list