tony2001                Tue Jun  5 12:17:15 2007 UTC

  Modified files:              
    /php-src/ext/standard       array.c 
  Log:
  fix folding
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.408&r2=1.409&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.408 php-src/ext/standard/array.c:1.409
--- php-src/ext/standard/array.c:1.408  Mon May 28 23:00:25 2007
+++ php-src/ext/standard/array.c        Tue Jun  5 12:17:15 2007
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.408 2007/05/28 23:00:25 iliaa Exp $ */
+/* $Id: array.c,v 1.409 2007/06/05 12:17:15 tony2001 Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -50,6 +50,7 @@
 #include "ext/spl/spl_array.h"
 #endif
 
+/* {{{ defines */
 #define EXTR_OVERWRITE                 0
 #define EXTR_SKIP                              1
 #define EXTR_PREFIX_SAME               2
@@ -86,6 +87,7 @@
 #define INTERSECT_COMP_KEY_USER      1
 
 #define DOUBLE_DRIFT_FIX       0.000000000000001
+/* }}} */
 
 ZEND_DECLARE_MODULE_GLOBALS(array)
 
@@ -97,7 +99,7 @@
 }
 /* }}} */
 
-PHP_MINIT_FUNCTION(array)
+PHP_MINIT_FUNCTION(array) /* {{{ */
 {
        ZEND_INIT_MODULE_GLOBALS(array, php_array_init_globals, NULL); 
 
@@ -126,8 +128,9 @@
        
        return SUCCESS;
 }
+/* }}} */
 
-PHP_MSHUTDOWN_FUNCTION(array)
+PHP_MSHUTDOWN_FUNCTION(array) /* {{{ */
 {
 #ifdef ZTS
        ts_free_id(array_globals_id);
@@ -135,8 +138,9 @@
 
        return SUCCESS;
 }
+/* }}} */
 
-PHPAPI void php_set_compare_func(int sort_type TSRMLS_DC)
+PHPAPI void php_set_compare_func(int sort_type TSRMLS_DC) /* {{{ */
 {
        switch (sort_type) {
                case SORT_NUMERIC:
@@ -157,8 +161,9 @@
                        break;
        }
 }
+/* }}} */
 
-static int array_key_compare(const void *a, const void *b TSRMLS_DC)
+static int array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */
 {
        Bucket *f;
        Bucket *s;
@@ -219,11 +224,13 @@
 
        return 0;
 }
+/* }}} */
 
-static int array_reverse_key_compare(const void *a, const void *b TSRMLS_DC)
+static int array_reverse_key_compare(const void *a, const void *b TSRMLS_DC) 
/* {{{ */
 {
        return array_key_compare(a, b TSRMLS_CC) * -1;
 }
+/* }}} */
 
 /* {{{ proto bool krsort(array &array_arg [, int sort_flags]) U
    Sort an array by key value in reverse order */
@@ -269,8 +276,7 @@
 }
 /* }}} */
 
-
-static int php_count_recursive(zval *array, long mode TSRMLS_DC)
+static int php_count_recursive(zval *array, long mode TSRMLS_DC) /* {{{ */
 {
        long cnt = 0;
        zval **element;
@@ -290,6 +296,7 @@
 
        return cnt;
 }
+/* }}} */
 
 /* {{{ proto int count(mixed var [, int mode]) U
    Count the number of elements in a variable (usually an array) */
@@ -344,7 +351,7 @@
  *
  * This is not correct any more, depends on what compare_func is set to.
  */
-PHPAPI int php_array_data_compare(const void *a, const void *b TSRMLS_DC)
+PHPAPI int php_array_data_compare(const void *a, const void *b TSRMLS_DC) /* 
{{{ */
 {
        Bucket *f;
        Bucket *s;
@@ -382,13 +389,15 @@
 
        return 0;
 }
+/* }}} */
 
-static int array_reverse_data_compare(const void *a, const void *b TSRMLS_DC)
+static int array_reverse_data_compare(const void *a, const void *b TSRMLS_DC) 
/* {{{ */
 {
        return php_array_data_compare(a, b TSRMLS_CC)*-1;
 }
+/* }}} */
 
-static int array_natural_general_compare(const void *a, const void *b, int 
fold_case TSRMLS_DC)
+static int array_natural_general_compare(const void *a, const void *b, int 
fold_case TSRMLS_DC) /* {{{ */
 {
        Bucket *f, *s;
        zval *fval, *sval;
@@ -427,18 +436,21 @@
        
        return result;
 }
+/* }}} */
 
-static int array_natural_compare(const void *a, const void *b TSRMLS_DC)
+static int array_natural_compare(const void *a, const void *b TSRMLS_DC) /* 
{{{ */
 {
        return array_natural_general_compare(a, b, 0 TSRMLS_CC);
 }
+/* }}} */
 
-static int array_natural_case_compare(const void *a, const void *b TSRMLS_DC)
+static int array_natural_case_compare(const void *a, const void *b TSRMLS_DC) 
/* {{{ */
 {
        return array_natural_general_compare(a, b, 1 TSRMLS_CC);
 }
+/* }}} */
 
-static void php_natsort(INTERNAL_FUNCTION_PARAMETERS, int fold_case)
+static void php_natsort(INTERNAL_FUNCTION_PARAMETERS, int fold_case) /* {{{ */
 {
        zval *array;
        HashTable *target_hash;
@@ -465,7 +477,7 @@
 
        RETURN_TRUE;
 }
-
+/* }}} */
 
 /* {{{ proto void natsort(array &array_arg) U
    Sort an array using natural sort */
@@ -475,7 +487,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto void natcasesort(array &array_arg) U
    Sort an array using case-insensitive natural sort */
 PHP_FUNCTION(natcasesort)
@@ -484,7 +495,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto bool asort(array &array_arg [, int sort_flags]) U
    Sort an array and maintain index association */
 PHP_FUNCTION(asort)
@@ -573,7 +583,7 @@
 }
 /* }}} */
 
-static int array_user_compare(const void *a, const void *b TSRMLS_DC)
+static int array_user_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */
 {
        Bucket *f;
        Bucket *s;
@@ -602,6 +612,7 @@
                return 0;
        }
 }
+/* }}} */
 
 /* check if comparison function is valid */
 #define PHP_ARRAY_CMP_FUNC_CHECK(func_name)    \
@@ -633,7 +644,6 @@
         BG(user_compare_fci) = old_user_compare_fci; \
         BG(user_compare_fci_cache) = old_user_compare_fci_cache; \
 
-
 /* {{{ proto bool usort(array array_arg, mixed comparator) U
    Sort an array by values using a user-defined comparison function */
 PHP_FUNCTION(usort)
@@ -688,7 +698,7 @@
 }
 /* }}} */
 
-static int array_user_key_compare(const void *a, const void *b TSRMLS_DC)
+static int array_user_key_compare(const void *a, const void *b TSRMLS_DC) /* 
{{{ */
 {
        Bucket *f;
        Bucket *s;
@@ -749,7 +759,7 @@
        
        return result;
 }
-
+/* }}} */
 
 /* {{{ proto bool uksort(array array_arg, mixed comparator) U
    Sort an array by keys using a user-defined comparison function */
@@ -1025,7 +1035,7 @@
 }
 /* }}} */
 
-static int php_array_walk(HashTable *target_hash, zval **userdata, int 
recursive TSRMLS_DC)
+static int php_array_walk(HashTable *target_hash, zval **userdata, int 
recursive TSRMLS_DC) /* {{{ */
 {
        zval **args[3],                 /* Arguments to userland function */
                  *retval_ptr,          /* Return value - unused */
@@ -1113,6 +1123,7 @@
        
        return 0;
 }
+/* }}} */
 
 /* {{{ proto bool array_walk(array input, mixed callback [, mixed userdata]) U
    Apply a user function to every member of an array */
@@ -1184,12 +1195,11 @@
 }
 /* }}} */
 
-
 /* void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
  *       0 = return boolean
  *       1 = return key
  */
-static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
+static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* 
{{{ */
 {
        zval *value,                            /* value to check for */
                 *array,                                /* array to check in */
@@ -1240,7 +1250,7 @@
 
        RETURN_FALSE;
 }
-
+/* }}} */
 
 /* {{{ proto bool in_array(mixed needle, array haystack [, bool strict]) U
    Checks if the given value exists in the array */
@@ -1258,8 +1268,7 @@
 }
 /* }}} */
 
-
-static int php_valid_var_name(zstr var_name, int var_name_len, int 
var_name_type)
+static int php_valid_var_name(zstr var_name, int var_name_len, int 
var_name_type) /* {{{ */
 {
        int i;
        
@@ -1285,9 +1294,9 @@
        
        return 1;
 }
+/* }}} */
 
-PHPAPI int php_prefix_varname(zval *result, zval *prefix, zstr var_name,
-                                                         int var_name_len, int 
var_name_type, zend_bool add_underscore TSRMLS_DC)
+PHPAPI int php_prefix_varname(zval *result, zval *prefix, zstr var_name, int 
var_name_len, int var_name_type, zend_bool add_underscore TSRMLS_DC) /* {{{ */
 {
        Z_UNILEN_P(result) = Z_UNILEN_P(prefix) + (add_underscore ? 1 : 0) + 
var_name_len;
        
@@ -1357,6 +1366,7 @@
 
        return SUCCESS;
 }
+/* }}} */
 
 /* {{{ proto int extract(array var_array [, int extract_type [, string 
prefix]]) U
    Imports variables into symbol table from an array */
@@ -1526,7 +1536,6 @@
 }
 /* }}} */
 
-
 /* {{{ php_compact_var */
 static void php_compact_var(HashTable *eg_active_symbol_table, zval 
*return_value, zval *entry)
 {
@@ -1581,7 +1590,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array compact(mixed var_names [, mixed ...]) U
    Creates a hash containing variables and their values */
 PHP_FUNCTION(compact)
@@ -1639,7 +1647,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_fill_keys(array keys, mixed val) U
    Create an array using the elements of the first parameter as keys each 
initialized to val */
 PHP_FUNCTION(array_fill_keys)
@@ -1683,7 +1690,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array range(mixed low, mixed high[, int step]) U
    Create an array containing the range of integers or characters from low to 
high (inclusive) */
 PHP_FUNCTION(range)
@@ -1880,8 +1886,7 @@
 }
 /* }}} */
 
-
-static void array_data_shuffle(zval *array TSRMLS_DC)
+static void array_data_shuffle(zval *array TSRMLS_DC) /* {{{ */
 {
        Bucket **elems, *temp;
        HashTable *hash;
@@ -1935,6 +1940,7 @@
 
        efree(elems);
 }
+/* }}} */
 
 /* {{{ proto bool shuffle(array array_arg) U
    Randomly shuffle the contents of an array */
@@ -1952,11 +1958,7 @@
 }
 /* }}} */
 
-
-/* HashTable* php_splice(HashTable *in_hash, int offset, int length,
-                                                zval ***list, int list_count, 
HashTable **removed) */
-HashTable* php_splice(HashTable *in_hash, int offset, int length,
-                                         zval ***list, int list_count, 
HashTable **removed)
+HashTable* php_splice(HashTable *in_hash, int offset, int length, zval 
***list, int list_count, HashTable **removed) /* {{{ */
 {
        HashTable       *out_hash = NULL;       /* Output hashtable */
        int                      num_in,                        /* Number of 
entries in the input hashtable */
@@ -2043,7 +2045,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto int array_push(array stack, mixed var [, mixed ...]) U
    Pushes elements onto the end of the array */
 PHP_FUNCTION(array_push)
@@ -2089,7 +2090,6 @@
 }
 /* }}} */
 
-
 /* {{{ void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) */
 static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
 {
@@ -2162,7 +2162,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto mixed array_shift(array stack) U
    Pops an element off the beginning of the array */
 PHP_FUNCTION(array_shift)
@@ -2171,7 +2170,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto int array_unshift(array stack, mixed var [, mixed ...]) U
    Pushes elements onto the beginning of the array */
 PHP_FUNCTION(array_unshift)
@@ -2219,7 +2217,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_splice(array input, int offset [, int length [, array 
replacement]]) U
    Removes the elements designated by offset and length and replace them with 
supplied array */
 PHP_FUNCTION(array_splice)
@@ -2277,7 +2274,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_slice(array input, int offset [, int length [, bool 
preserve_keys]]) U
    Returns elements specified by offset and length */
 PHP_FUNCTION(array_slice)
@@ -2366,8 +2362,7 @@
 }
 /* }}} */
 
-
-PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive 
TSRMLS_DC)
+PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive 
TSRMLS_DC) /* {{{ */
 {
        zval **src_entry, **dest_entry;
        zstr string_key;
@@ -2419,8 +2414,9 @@
 
        return 1;
 }
+/* }}} */
 
-static void php_array_merge_wrapper(INTERNAL_FUNCTION_PARAMETERS, int 
recursive)
+static void php_array_merge_wrapper(INTERNAL_FUNCTION_PARAMETERS, int 
recursive) /* {{{ */
 {
        zval ***args = NULL;
        int argc, i, params_ok = 1;
@@ -2459,7 +2455,7 @@
        
        efree(args);
 }
-
+/* }}} */
 
 /* {{{ proto array array_merge(array arr1, array arr2 [, array ...]) U
    Merges elements from passed arrays into one array */
@@ -2469,7 +2465,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_merge_recursive(array arr1, array arr2 [, array ...]) 
U
    Recursively merges elements from passed arrays into one array */
 PHP_FUNCTION(array_merge_recursive)
@@ -2478,7 +2473,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_keys(array input [, mixed search_value[, bool 
strict]]) U
    Return just the keys from the input array, optionally only for the 
specified search_value */
 PHP_FUNCTION(array_keys)
@@ -2545,7 +2539,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_values(array input) U
    Return just the values from the input array */
 PHP_FUNCTION(array_values)
@@ -2572,7 +2565,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_count_values(array input) U
    Return the value as key and the frequency of that value in input as value */
 PHP_FUNCTION(array_count_values)
@@ -2624,7 +2616,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_reverse(array input [, bool preserve keys]) U
    Return input as a new array with the order of the entries reversed */
 PHP_FUNCTION(array_reverse)
@@ -2675,7 +2666,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_pad(array input, int pad_size, mixed pad_value) U
    Returns a copy of input array padded with pad_value to size pad_size */
 PHP_FUNCTION(array_pad)
@@ -2789,7 +2779,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_change_key_case(array input [, int case=CASE_LOWER]) U
    Retuns an array with all string keys lowercased [or uppercased] */
 PHP_FUNCTION(array_change_key_case)
@@ -3213,7 +3202,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_intersect_key(array arr1, array arr2 [, array ...]) U
    Returns the entries of arr1 that have keys which are present in all the 
other arguments. Kind of equivalent to array_diff(array_keys($arr1), 
array_keys($arr2)[,array_keys(...)]). Equivalent of array_intersect_assoc() but 
does not do compare of the data. */
 PHP_FUNCTION(array_intersect_key)
@@ -3232,7 +3220,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_intersect(array arr1, array arr2 [, array ...]) U
    Returns the entries of arr1 that have values which are present in all the 
other arguments */
 PHP_FUNCTION(array_intersect)
@@ -3251,7 +3238,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_intersect_assoc(array arr1, array arr2 [, array ...]) 
U
    Returns the entries of arr1 that have values which are present in all the 
other arguments. Keys are used to do more restrictive check */
 PHP_FUNCTION(array_intersect_assoc)
@@ -3270,7 +3256,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_uintersect_assoc(array arr1, array arr2 [, array 
...], callback data_compare_func) U
    Returns the entries of arr1 that have values which are present in all the 
other arguments. Keys are used to do more restrictive check. Data is compared 
by using an user-supplied callback. */
 PHP_FUNCTION(array_uintersect_assoc)
@@ -3289,9 +3274,7 @@
 }
 /* }}} */
 
-
-/* {{{ php_array_diff */
-static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int 
data_compare_type, int key_compare_type)
+static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int 
data_compare_type, int key_compare_type) /* {{{ */
 {
        zval ***args = NULL;
        HashTable *hash;
@@ -3587,7 +3570,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_diff_key(array arr1, array arr2 [, array ...]) U
    Returns the entries of arr1 that have keys which are not present in any of 
the others arguments. This function is like array_diff() but works on the keys 
instead of the values. The associativity is preserved. */
 PHP_FUNCTION(array_diff_key)
@@ -3606,7 +3588,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_diff(array arr1, array arr2 [, array ...]) U
    Returns the entries of arr1 that have values which are not present in any 
of the others arguments. */
 PHP_FUNCTION(array_diff)
@@ -3625,7 +3606,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_diff_assoc(array arr1, array arr2 [, array ...]) U
    Returns the entries of arr1 that have values which are not present in any 
of the others arguments but do additional checks whether the keys are equal */
 PHP_FUNCTION(array_diff_assoc)
@@ -3644,7 +3624,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_udiff_assoc(array arr1, array arr2 [, array ...], 
callback data_comp_func) U
    Returns the entries of arr1 that have values which are not present in any 
of the others arguments but do additional checks whether the keys are equal. 
Entries are compared by user supplied function. */
 PHP_FUNCTION(array_udiff_assoc)
@@ -3663,12 +3642,11 @@
 }
 /* }}} */
 
-
 #define MULTISORT_ORDER        0
 #define MULTISORT_TYPE 1
 #define MULTISORT_LAST 2
 
-int multisort_compare(const void *a, const void *b TSRMLS_DC)
+int multisort_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */
 {
        Bucket **ab = *(Bucket ***)a;
        Bucket **bb = *(Bucket ***)b;
@@ -3690,6 +3668,7 @@
 
        return result;
 }
+/* }}} */
 
 #define MULTISORT_ABORT                                                \
        for (k = 0; k < MULTISORT_LAST; k++)    \
@@ -3882,7 +3861,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto mixed array_rand(array input [, int num_req]) U
    Return key/keys for random entry/entries in the array */
 PHP_FUNCTION(array_rand)
@@ -4035,7 +4013,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto mixed array_reduce(array input, mixed callback [, int initial]) U
    Iteratively reduce the array to a single value via the callback. */
 PHP_FUNCTION(array_reduce)
@@ -4108,7 +4085,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_filter(array input [, mixed callback]) U
    Filters elements from the array via the callback. */
 PHP_FUNCTION(array_filter)
@@ -4184,7 +4160,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_map(mixed callback, array input1 [, array input2 
,...]) U
    Applies the callback to the elements in given arrays. */
 PHP_FUNCTION(array_map)
@@ -4331,7 +4306,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto bool array_key_exists(mixed key, array search) U
    Checks if the given key or index exists in the array */
 PHP_FUNCTION(array_key_exists)
@@ -4373,7 +4347,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto array array_chunk(array input, int size [, bool preserve_keys]) U
    Split array into chunks */
 PHP_FUNCTION(array_chunk)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to