1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

ext/spl: use ecalloc instead of complicate memset to 0

This commit is contained in:
Gina Peter Banyard
2024-06-10 00:08:16 +01:00
parent 5337172508
commit f0fb9e34a5

View File

@@ -186,10 +186,7 @@ static zend_object *spl_filesystem_object_new(zend_class_entry *class_type)
{
spl_filesystem_object *intern;
intern = emalloc(sizeof(spl_filesystem_object) + zend_object_properties_size(class_type));
memset(intern, 0,
MAX(XtOffsetOf(spl_filesystem_object, u.dir.entry),
XtOffsetOf(spl_filesystem_object, u.file.escape) + sizeof(int)));
intern = ecalloc(1, sizeof(spl_filesystem_object) + zend_object_properties_size(class_type));
/* intern->type = SPL_FS_INFO; done by set 0 */
intern->file_class = spl_ce_SplFileObject;
intern->info_class = spl_ce_SplFileInfo;