derick          Wed Mar 15 09:50:47 2006 UTC

  Modified files:              
    /php-src/ext/standard       var.c 
  Log:
  - Reduce space in serialization. The first 128 bytes will now use just the
    character and everything above will use \uXXXX. It seems that unserialize
    doesn't work at all yet on the U: element so that I added to my to-do list.
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/var.c?r1=1.224&r2=1.225&diff_format=u
Index: php-src/ext/standard/var.c
diff -u php-src/ext/standard/var.c:1.224 php-src/ext/standard/var.c:1.225
--- php-src/ext/standard/var.c:1.224    Fri Mar 10 08:43:14 2006
+++ php-src/ext/standard/var.c  Wed Mar 15 09:50:47 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: var.c,v 1.224 2006/03/10 08:43:14 dmitry Exp $ */
+/* $Id: var.c,v 1.225 2006/03/15 09:50:47 derick Exp $ */
 
 
 
@@ -681,11 +681,15 @@
 
        for(i=0; i<len; /* U16_NEXT post-increments */) {
                U16_NEXT(ustr, i, len, c);
-               smart_str_appendl(buf, "\\u", 2);
-               smart_str_appendc(buf, hex[(c >> 12) & 0xf]);
-               smart_str_appendc(buf, hex[(c >> 8) & 0xf]);
-               smart_str_appendc(buf, hex[(c >> 4) & 0xf]);
-               smart_str_appendc(buf, hex[(c >> 0) & 0xf]);
+               if (c < 128) {
+                       smart_str_appendc(buf, c & 0xff);
+               } else {
+                       smart_str_appendl(buf, "\\u", 2);
+                       smart_str_appendc(buf, hex[(c >> 12) & 0xf]);
+                       smart_str_appendc(buf, hex[(c >> 8) & 0xf]);
+                       smart_str_appendc(buf, hex[(c >> 4) & 0xf]);
+                       smart_str_appendc(buf, hex[(c >> 0) & 0xf]);
+               }
        }
 }
 

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

Reply via email to