From: Marcus Boerger Date: Wed, 20 Dec 2006 20:59:18 +0000 (+0000) Subject: - Make shorter and do not use problematic attribute X-Git-Tag: RELEASE_1_0_0RC1~603 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=71a73834f43744c3a3d8fc3193ae77bedd3d96cd;p=php - Make shorter and do not use problematic attribute --- diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index e86be9f95f..6507a393d9 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -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) diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index a7a3891d07..c79d3ffd46 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -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;