2010/4/9 Kalle Sommer Nielsen <ka...@php.net>:
> Hey Everyone
>
> I've put together a simple RFC[1] that lists features thats been
> deprecated in 5.3, someone of them which I propose we remove in the
> next version of PHP, depending on the version number. Most of the
> features, which is listed below are taken from the old 6.0 NEWS[2]
> file, and items from the old PHP6 TODO[3].
>
> safe_mode/register_globals/register_long_arrays/magic_quotes_*/allow_call_time_pass_reference
>  - Something we have long time been wanted to remove from PHP, I don't
> see a big reason to keep those in the next version, even if its going
> to be a 5.4, since we already removed things like
> zend.ze1_compatibility_mode. See the magic quotes RFC[4].
>
> define_syslog_variables and its associated function
>  - Originally agreed to be removed in PHP6 during the 5.3 development,
> if there is no objects then I will remove by the end of this weekend.
>
> asp_tags
>  - Proposed to be removed aswell, Tony had a patch for this[5].
>
> sql_safe_mode
>  - Theres currently an RFC in the works about this by Johannes[6].
>
> session_register/session_is_registered/session_register
>  - Only needed for register_globals, Hannes removed those in PHP6.
>
> enable_dl
>  - Is this really worth keeping, since dl() was disabled on almost all
> SAPIs except for CLI/CGI/Embed?
>
> Support for Freetype 1 and GD 1
>  - Removed by Pierre in PHP6
>
> Support for "continue" and "break" operators with non constant operands
>  - Removed by Dmitry in PHP6.
>
> Undocumented and incomplete support for strings in list() operator
>  - Removed by Dmitry in PHP6 aswell.
>
> detect_unicode/highlight_bg
>  - Two ini values thats been marked as removed features from PHP6 in
> the manual. Not sure about detect_unicode, but highlight_bg is pretty
> pointless.
>
> y2k_compliance
>  - From the manual "Enforce year 2000 compliance (will cause problems
> with non-compliant browsers)", we are in 2010, we should remove this
> option and enable it by default and remove the checks. Perhaps Derick
> got an insight here?
>
> Class named constructors
>  - A feature thats been marked in the manual as something that would
> be removed in a future version of PHP6. It was not to be knowing ever
> decided to be kept or not, but now with the recent removal of them in
> namespaces then I don't see a big point in keeping them.
>
>
> If there is anything I forgot then let me know and I will add it to
> the RFC, else discussions away!
>
>
> [1] http://wiki.php.net/rfc/removal-of-deprecated-features
> [2] 
> http://svn.php.net/viewvc/php/php-src/branches/FIRST_UNICODE_IMPLEMENTATION/NEWS?view=markup
> [3] http://wiki.php.net/todo/php60
> [4] http://wiki.php.net/rfc/magicquotes
> [5] http://marc.info/?l=php-internals&m=117640641605813&w=2
> [6] http://wiki.php.net/rfc/drop_sql.safe_mode
>
> --
> regards,
>
> Kalle Sommer Nielsen
> ka...@php.net
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Hi!

I think we should also keep an eye on removing dead code.
Removing the useless: main/mergesort.c for example (Patch in attachment).

I think I don't have enough karma to commit this.

Regards,

-- 
Patrick Allaert
---
http://code.google.com/p/peclapm/ - Alternative PHP Monitor
Index: configure.in
===================================================================
--- configure.in        (revision 298018)
+++ configure.in        (working copy)
@@ -1394,7 +1394,7 @@
 PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \
        safe_mode.c fopen_wrappers.c alloca.c  php_scandir.c \
        php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
-       strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \
+       strlcat.c reentrancy.c php_variables.c php_ticks.c \
        network.c php_open_temporary_file.c php_logos.c \
        output.c getopt.c)
 
Index: main/mergesort.c
===================================================================
--- main/mergesort.c    (revision 298018)
+++ main/mergesort.c    (working copy)
@@ -1,358 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Peter McIlroy.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* $Id$ */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)merge.c    8.2 (Berkeley) 2/14/94";
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * Hybrid exponential search/linear search merge sort with hybrid
- * natural/pairwise first pass.  Requires about .3% more comparisons
- * for random data than LSMS with pairwise first pass alone.
- * It works for objects as small as two bytes.
- */
-
-#define NATURAL
-#define THRESHOLD 16   /* Best choice for natural merge cut-off. */
-
-/* #define NATURAL to get hybrid natural merge.
- * (The default is pairwise merging.)
- */
-
-#include <sys/types.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "php.h"
-
-#ifdef PHP_WIN32
-#include <winsock2.h> /* Includes definition for u_char */
-#endif
-
-static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int 
(*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC);
-static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const 
void *, const void * TSRMLS_DC) TSRMLS_DC);
-
-#define ISIZE sizeof(int)
-#define PSIZE sizeof(u_char *)
-#define ICOPY_LIST(src, dst, last)                             \
-       do                                                      \
-       *(int*)dst = *(int*)src, src += ISIZE, dst += ISIZE;    \
-       while(src < last)
-#define ICOPY_ELT(src, dst, i)                                 \
-       do                                                      \
-       *(int*) dst = *(int*) src, src += ISIZE, dst += ISIZE;  \
-       while (i -= ISIZE)
-
-#define CCOPY_LIST(src, dst, last)             \
-       do                                      \
-               *dst++ = *src++;                \
-       while (src < last)
-#define CCOPY_ELT(src, dst, i)                 \
-       do                                      \
-               *dst++ = *src++;                \
-       while (i -= 1)
-
-/*
- * Find the next possible pointer head.  (Trickery for forcing an array
- * to do double duty as a linked list when objects do not align with word
- * boundaries.
- */
-/* Assumption: PSIZE is a power of 2. */
-#define EVAL(p) (u_char **)                                            \
-               ((u_char *)0 +                                                  
\
-           (((u_char *)p + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1)))
-
-/* {{{ php_mergesort
- * Arguments are as for qsort.
- */
-PHPAPI int php_mergesort(void *base, size_t nmemb, size_t size, int 
(*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC)
-{
-       register unsigned int i;
-       register int sense;
-       int big, iflag;
-       register u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2;
-       u_char *list2, *list1, *p2, *p, *last, **p1;
-
-       if (size < PSIZE / 2) {         /* Pointers must fit into 2 * size. */
-               errno = EINVAL;
-               return (-1);
-       }
-
-       if (nmemb == 0)
-               return (0);
-
-       /*
-        * XXX
-        * Stupid subtraction for the Cray.
-        */
-       iflag = 0;
-       if (!(size % ISIZE) && !(((char *)base - (char *)0) % ISIZE))
-               iflag = 1;
-
-       if ((list2 = malloc(nmemb * size + PSIZE)) == NULL)
-               return (-1);
-
-       list1 = base;
-       setup(list1, list2, nmemb, size, cmp TSRMLS_CC);
-       last = list2 + nmemb * size;
-       i = big = 0;
-       while (*EVAL(list2) != last) {
-           l2 = list1;
-           p1 = EVAL(list1);
-           for (tp2 = p2 = list2; p2 != last; p1 = EVAL(l2)) {
-               p2 = *EVAL(p2);
-               f1 = l2;
-               f2 = l1 = list1 + (p2 - list2);
-               if (p2 != last)
-                       p2 = *EVAL(p2);
-               l2 = list1 + (p2 - list2);
-               while (f1 < l1 && f2 < l2) {
-                       if ((*cmp)(f1, f2 TSRMLS_CC) <= 0) {
-                               q = f2;
-                               b = f1, t = l1;
-                               sense = -1;
-                       } else {
-                               q = f1;
-                               b = f2, t = l2;
-                               sense = 0;
-                       }
-                       if (!big) {     /* here i = 0 */
-                               while ((b += size) < t && cmp(q, b TSRMLS_CC) 
>sense)
-                                       if (++i == 6) {
-                                               big = 1;
-                                               goto EXPONENTIAL;
-                                       }
-                       } else {
-EXPONENTIAL:                   for (i = size; ; i <<= 1)
-                                       if ((p = (b + i)) >= t) {
-                                               if ((p = t - size) > b &&
-                                                   (*cmp)(q, p TSRMLS_CC) <= 
sense)
-                                                       t = p;
-                                               else
-                                                       b = p;
-                                               break;
-                                       } else if ((*cmp)(q, p TSRMLS_CC) <= 
sense) {
-                                               t = p;
-                                               if (i == size)
-                                                       big = 0;
-                                               goto FASTCASE;
-                                       } else
-                                               b = p;
-                               while (t > b+size) {
-                                       i = (((t - b) / size) >> 1) * size;
-                                       if ((*cmp)(q, p = b + i TSRMLS_CC) <= 
sense)
-                                               t = p;
-                                       else
-                                               b = p;
-                               }
-                               goto COPY;
-FASTCASE:                      while (i > size)
-                                       if ((*cmp)(q,
-                                               p = b + (i >>= 1) TSRMLS_CC) <= 
sense)
-                                               t = p;
-                                       else
-                                               b = p;
-COPY:                          b = t;
-                       }
-                       i = size;
-                       if (q == f1) {
-                               if (iflag) {
-                                       ICOPY_LIST(f2, tp2, b);
-                                       ICOPY_ELT(f1, tp2, i);
-                               } else {
-                                       CCOPY_LIST(f2, tp2, b);
-                                       CCOPY_ELT(f1, tp2, i);
-                               }
-                       } else {
-                               if (iflag) {
-                                       ICOPY_LIST(f1, tp2, b);
-                                       ICOPY_ELT(f2, tp2, i);
-                               } else {
-                                       CCOPY_LIST(f1, tp2, b);
-                                       CCOPY_ELT(f2, tp2, i);
-                               }
-                       }
-               }
-               if (f2 < l2) {
-                       if (iflag)
-                               ICOPY_LIST(f2, tp2, l2);
-                       else
-                               CCOPY_LIST(f2, tp2, l2);
-               } else if (f1 < l1) {
-                       if (iflag)
-                               ICOPY_LIST(f1, tp2, l1);
-                       else
-                               CCOPY_LIST(f1, tp2, l1);
-               }
-               *p1 = l2;
-           }
-           tp2 = list1;        /* swap list1, list2 */
-           list1 = list2;
-           list2 = tp2;
-           last = list2 + nmemb*size;
-       }
-       if (base == list2) {
-               memmove(list2, list1, nmemb*size);
-               list2 = list1;
-       }
-       free(list2);
-       return (0);
-}
-/* }}} */
-
-#define        swap(a, b) {                                    \
-               s = b;                                  \
-               i = size;                               \
-               do {                                    \
-                       tmp = *a; *a++ = *s; *s++ = tmp; \
-               } while (--i);                          \
-               a -= size;                              \
-       }
-#define reverse(bot, top) {                            \
-       s = top;                                        \
-       do {                                            \
-               i = size;                               \
-               do {                                    \
-                       tmp = *bot; *bot++ = *s; *s++ = tmp; \
-               } while (--i);                          \
-               s -= size2;                             \
-       } while(bot < s);                               \
-}
-
-/* {{{ setup
- * Optional hybrid natural/pairwise first pass.  Eats up list1 in runs of
- * increasing order, list2 in a corresponding linked list.  Checks for runs
- * when THRESHOLD/2 pairs compare with same sense.  (Only used when NATURAL
- * is defined.  Otherwise simple pairwise merging is used.)
- */
-static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int 
(*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC)
-{
-       int i, length, size2, tmp, sense;
-       u_char *f1, *f2, *s, *l2, *last, *p2;
-
-       size2 = size*2;
-       if (n <= 5) {
-               insertionsort(list1, n, size, cmp TSRMLS_CC);
-               *EVAL(list2) = (u_char*) list2 + n*size;
-               return;
-       }
-       /*
-        * Avoid running pointers out of bounds; limit n to evens
-        * for simplicity.
-        */
-       i = 4 + (n & 1);
-       insertionsort(list1 + (n - i) * size, i, size, cmp TSRMLS_CC);
-       last = list1 + size * (n - i);
-       *EVAL(list2 + (last - list1)) = list2 + n * size;
-
-#ifdef NATURAL
-       p2 = list2;
-       f1 = list1;
-       sense = (cmp(f1, f1 + size TSRMLS_CC) > 0);
-       for (; f1 < last; sense = !sense) {
-               length = 2;
-                                       /* Find pairs with same sense. */
-               for (f2 = f1 + size2; f2 < last; f2 += size2) {
-                       if ((cmp(f2, f2+ size TSRMLS_CC) > 0) != sense)
-                               break;
-                       length += 2;
-               }
-               if (length < THRESHOLD) {               /* Pairwise merge */
-                       do {
-                               p2 = *EVAL(p2) = f1 + size2 - list1 + list2;
-                               if (sense > 0)
-                                       swap (f1, f1 + size);
-                       } while ((f1 += size2) < f2);
-               } else {                                /* Natural merge */
-                       l2 = f2;
-                       for (f2 = f1 + size2; f2 < l2; f2 += size2) {
-                               if ((cmp(f2-size, f2 TSRMLS_CC) > 0) != sense) {
-                                       p2 = *EVAL(p2) = f2 - list1 + list2;
-                                       if (sense > 0)
-                                               reverse(f1, f2-size);
-                                       f1 = f2;
-                               }
-                       }
-                       if (sense > 0)
-                               reverse (f1, f2-size);
-                       f1 = f2;
-                       if (f2 < last || cmp(f2 - size, f2 TSRMLS_CC) > 0)
-                               p2 = *EVAL(p2) = f2 - list1 + list2;
-                       else
-                               p2 = *EVAL(p2) = list2 + n*size;
-               }
-       }
-#else          /* pairwise merge only. */
-       for (f1 = list1, p2 = list2; f1 < last; f1 += size2) {
-               p2 = *EVAL(p2) = p2 + size2;
-               if (cmp (f1, f1 + size TSRMLS_CC) > 0)
-                       swap(f1, f1 + size);
-       }
-#endif /* NATURAL */
-}
-/* }}} */
-
-/* {{{ insertionsort
- * This is to avoid out-of-bounds addresses in sorting the
- * last 4 elements.
- */
-static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const 
void *, const void * TSRMLS_DC) TSRMLS_DC)
-{
-       u_char *ai, *s, *t, *u, tmp;
-       int i;
-
-       for (ai = a+size; --n >= 1; ai += size)
-               for (t = ai; t > a; t -= size) {
-                       u = t - size;
-                       if (cmp(u, t TSRMLS_CC) <= 0)
-                               break;
-                       swap(u, t);
-               }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
Index: win32/php5dllts.dsp
===================================================================
--- win32/php5dllts.dsp (revision 298018)
+++ win32/php5dllts.dsp (working copy)
@@ -181,10 +181,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\main\mergesort.c
-# End Source File
-# Begin Source File
-
 SOURCE=..\main\network.c
 # End Source File
 # Begin Source File
Index: win32/php5dll.dsp
===================================================================
--- win32/php5dll.dsp   (revision 298018)
+++ win32/php5dll.dsp   (working copy)
@@ -144,10 +144,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\main\mergesort.c
-# End Source File
-# Begin Source File
-
 SOURCE=..\main\network.c
 # End Source File
 # Begin Source File
Index: win32/build/config.w32
===================================================================
--- win32/build/config.w32      (revision 298018)
+++ win32/build/config.w32      (working copy)
@@ -333,7 +333,7 @@
 
 ADD_SOURCES("main", "main.c snprintf.c spprintf.c safe_mode.c getopt.c 
fopen_wrappers.c \
        php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
-       strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c 
network.c \
+       strlcat.c reentrancy.c php_variables.c php_ticks.c network.c \
        php_open_temporary_file.c php_logos.c output.c internal_functions.c 
php_sprintf.c");
 ADD_SOURCES("win32", "inet.c fnmatch.c sockets.c");
 
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to