pike.git/
lib/
modules/
Array.pmod
Branch:
Tag:
Non-build tags
All tags
No tags
2014-08-15
2014-08-15 20:21:17 by Martin Nilsson <nilsson@opera.com>
65340dad94929b9453d257da775e130a77c3cb6f (
9
lines) (+
5
/-
4
)
[
Show
|
Annotate
]
Branch:
8.0
Less zero_type.
578:
return res; }
-
//! Make an array of the argument, if it isn't already.
A
zero_type
+
//! Make an array of the argument, if it isn't already.
An
undefined
//! argument gives the empty array. This is useful when something is //! either an array or a basic datatype, for instance in headers from //! the MIME module or Protocols.HTTP.Server.
587:
//! @dl //! @item arrayp(x) //! arrayify(x) => x
-
//! @item
zero_type
(x)
+
//! @item
undefinedp
(x)
//! arrayify(x) => ({}) //! @item otherwise //! arrayify(x) => ({ x }) //! @enddl array arrayify(void|array|mixed x) {
-
if(
zero_type
(x)) return ({});
+
if(
undefinedp
(x)) return ({});
if(arrayp(x)) return [array]x; return ({ x }); }
697:
int|mapping(mixed:int) count(array|mapping|multiset haystack, mixed|void needle) {
-
if(
zero_type
(needle))
+
if(
undefinedp
(needle))
{ mapping(mixed:int) res = ([]); if(mappingp(haystack))