]> granicus.if.org Git - php/commitdiff
- Make shorter and do not use problematic attribute
authorMarcus Boerger <helly@php.net>
Wed, 20 Dec 2006 20:59:18 +0000 (20:59 +0000)
committerMarcus Boerger <helly@php.net>
Wed, 20 Dec 2006 20:59:18 +0000 (20:59 +0000)
Zend/zend_alloc.c
Zend/zend_alloc.h

index e86be9f95fe03975f2e584d9a36a2fefc1a98bb5..6507a393d99c181171376543fc76c82e2f5dc379 100644 (file)
@@ -2033,15 +2033,13 @@ ZEND_API UChar *zend_ustrndup(const UChar *s, uint length)
        return p;
 }
 
-ZEND_API void *zend_zstrndup(int type, const zstr s, uint length)
+ZEND_API zstr zend_zstrndup(int type, const zstr s, uint length)
 {
-       zstr result;
        if (type == IS_STRING) {
-               result.s = zend_strndup(s.s, length);
+               return (zstr)zend_strndup(s.s, length);
        } else {
-               result.u = zend_ustrndup(s.u, length);
+               return (zstr)zend_ustrndup(s.u, length);
        }
-       return result;
 }
 
 ZEND_API int zend_set_memory_limit(unsigned int memory_limit)
index a7a3891d071a6fde869ec6e5e49701e3913624b7..c79d3ffd46fba4967013ca16a773ec2bf53f8cc5 100644 (file)
@@ -41,7 +41,7 @@ BEGIN_EXTERN_C()
 
 ZEND_API char *zend_strndup(const char *s, unsigned int length) ZEND_ATTRIBUTE_MALLOC;
 ZEND_API UChar *zend_ustrndup(const UChar *s, uint length) ZEND_ATTRIBUTE_MALLOC;
-ZEND_API void *zend_zstrndup(int type, const zstr s, uint length) ZEND_ATTRIBUTE_MALLOC;
+ZEND_API zstr zend_zstrndup(int type, const zstr s, uint length);
 
 ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
 ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;