pike.git/
lib/
master.pike.in
Branch:
Tag:
Non-build tags
All tags
No tags
2004-07-04
2004-07-04 14:51:19 by Martin Stjernholm <mast@lysator.liu.se>
e44a0d78552cf5d222f60df36ba06310dca7243d (
16
lines) (+
11
/-
5
)
[
Show
|
Annotate
]
Branch:
7.9
Fixed some comments about the reason for the codecs mapping.
Rev: lib/master.pike.in:1.354
6:
// Pike is distributed under GPL, LGPL and MPL. See the file COPYING // for more information. //
-
// $Id: master.pike.in,v 1.
353
2004/07/04 14:
30
:
09
mast Exp $
+
// $Id: master.pike.in,v 1.
354
2004/07/04 14:
51
:
19
mast Exp $
#pike __REAL_VERSION__ //#pragma strict_types
4226:
} }
-
mapping(string:Decoder) codecs = set_weak_flag(([]),1);
+
// Note: This
mapping
is not for caching but for coping with recursion
+
// problems by returning the same codec for the same file. As a cache
+
// it's really pointless.
+
static mapping
(string:Decoder) codecs = set_weak_flag
(([]),
1);
+
Decoder get_codec(string|void fname, int|void mkobj, void|object handler) { if (handler)
-
//
Maybe
cache
these
too?
Not
done
right
now
since
explicit
-
//
handlers
are
fairly
rare.
Note
that
caching
easily
could
-
//
introduce
a
cyclic
ref
through
Decoder
.handler.
+
//
Decoders
are
currently
not
reused
in
this
case
since
it's
+
//
tricky
to
set
up
a
weak
multilevel
mapping
for lookup. This is
+
//
seldom
a
problem
since
explicit
handlers are fairly rare
.
If it
+
// is then the
handler
can always override this function
.
return Decoder (fname, mkobj, handler); string key = fname + "\0" + mkobj; if (codecs[key]) return codecs[key];