logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

cvs: ZendEngine2 / zend_alloc.c zend_alloc.h: msg#00003

Subject: cvs: ZendEngine2 / zend_alloc.c zend_alloc.h
pollita         Sun Jan  7 05:45:07 2007 UTC

  Modified files:              
    /ZendEngine2        zend_alloc.c zend_alloc.h 
  Log:
  Fix prior commit noticing this time that persistent allocators start with 
zend_*() and that one already exists
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_alloc.c?r1=1.187&r2=1.188&diff_format=u
Index: ZendEngine2/zend_alloc.c
diff -u ZendEngine2/zend_alloc.c:1.187 ZendEngine2/zend_alloc.c:1.188
--- ZendEngine2/zend_alloc.c:1.187      Sun Jan  7 05:24:55 2007
+++ ZendEngine2/zend_alloc.c    Sun Jan  7 05:45:07 2007
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_alloc.c,v 1.187 2007/01/07 05:24:55 pollita Exp $ */
+/* $Id: zend_alloc.c,v 1.188 2007/01/07 05:45:07 pollita Exp $ */
 
 #include "zend.h"
 #include "zend_alloc.h"
@@ -2013,33 +2013,6 @@
        return p;
 }
 
-ZEND_API UChar *_peustrdup(const UChar *s)
-{
-       int length;
-       UChar *p;
-
-       length = u_strlen(s)+1;
-       p = (UChar *) malloc(sizeof(UChar) * length);
-       if (!p) {
-               return (UChar *)NULL;
-       }
-       u_memcpy(p, s, length);
-       return p;
-}
-
-ZEND_API UChar *_peustrndup(const UChar *s, int length)
-{
-        UChar *p;
-
-        p = (UChar *) malloc(sizeof(UChar) * (length+1));
-        if (!p) {
-                return (UChar *)NULL;
-        }
-        memcpy(p, s, length * sizeof(UChar));
-        p[length] = 0;
-        return p;
-}
-
 ZEND_API zstr _ezstrndup(int type, const zstr s, uint length ZEND_FILE_LINE_DC 
ZEND_FILE_LINE_ORIG_DC)
 {
        if (type == IS_STRING) {
@@ -2065,6 +2038,23 @@
        return p;
 }
 
+ZEND_API UChar *zend_ustrdup(const UChar *s)
+{
+       UChar *p;
+       uint length;
+
+       length = u_strlen(s)+1;
+       p = (UChar *) malloc(UBYTES(length+1));
+       if (!p) {
+               return (UChar *)NULL;
+       }
+       if (length) {
+               memcpy(p, s, UBYTES(length));
+       }
+       p[length] = 0;
+       return p;
+}
+
 ZEND_API UChar *zend_ustrndup(const UChar *s, uint length)
 {
        UChar *p;
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_alloc.h?r1=1.82&r2=1.83&diff_format=u
Index: ZendEngine2/zend_alloc.h
diff -u ZendEngine2/zend_alloc.h:1.82 ZendEngine2/zend_alloc.h:1.83
--- ZendEngine2/zend_alloc.h:1.82       Sun Jan  7 05:24:55 2007
+++ ZendEngine2/zend_alloc.h    Sun Jan  7 05:45:07 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_alloc.h,v 1.82 2007/01/07 05:24:55 pollita Exp $ */
+/* $Id: zend_alloc.h,v 1.83 2007/01/07 05:45:07 pollita Exp $ */
 
 #ifndef ZEND_ALLOC_H
 #define ZEND_ALLOC_H
@@ -40,6 +40,7 @@
 BEGIN_EXTERN_C()
 
 ZEND_API char *zend_strndup(const char *s, unsigned int length) 
ZEND_ATTRIBUTE_MALLOC;
+ZEND_API UChar *zend_ustrdup(const UChar *s) ZEND_ATTRIBUTE_MALLOC;
 ZEND_API UChar *zend_ustrndup(const UChar *s, uint length) 
ZEND_ATTRIBUTE_MALLOC;
 ZEND_API zstr zend_zstrndup(int type, const zstr s, uint length);
 
@@ -55,8 +56,6 @@
 ZEND_API UChar *_eustrndup(const UChar *s, int length ZEND_FILE_LINE_DC 
ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
 ZEND_API zstr _ezstrndup(int type, const zstr s, uint length ZEND_FILE_LINE_DC 
ZEND_FILE_LINE_ORIG_DC);
 ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC 
ZEND_FILE_LINE_ORIG_DC);
-ZEND_API UChar *_peustrdup(const UChar *s) ZEND_ATTRIBUTE_MALLOC;
-ZEND_API UChar *_peustrndup(const UChar *s, int length) ZEND_ATTRIBUTE_MALLOC;
 
 /* Standard wrapper macros */
 #define emalloc(size)                                  _emalloc((size) 
ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
@@ -96,8 +95,9 @@
 #define pestrdup(s, persistent) ((persistent)?strdup(s):estrdup(s))
 #define peumalloc(size, persistent) 
((persistent)?malloc(UBYTES(size)):eumalloc(size))
 #define peurealloc(ptr, size, persistent) 
((persistent)?realloc((ptr),UBYTES(size)):eurealloc((ptr),size))
-#define peustrdup(s, persistent) ((persistent)?_peustrdup((s)):eustrdup((s)))
-#define peustrndup(s, length, persistent) 
((persistent)?_peustrndup((s),(length)):eustrndup((s),(length)))
+#define peustrdup(s, persistent) ((persistent)?zend_ustrdup((s)):eustrdup((s)))
+#define peustrndup(s, length, persistent) 
((persistent)?zend_ustrndup((s),(length)):eustrndup((s),(length)))
+#define pezstrndup(type, s, length, persistent) 
((persistent)?zend_zstrndup((type),(s),(length)):ezstrndup((type),(s),(length)))
 
 #define pemalloc_rel(size, persistent) 
((persistent)?malloc(size):emalloc_rel(size))
 #define pefree_rel(ptr, persistent)    ((persistent)?free(ptr):efree_rel(ptr))

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




<Prev in Thread] Current Thread [Next in Thread>