Skip to content

Commit f0fb9e3

Browse files
committed
ext/spl: use ecalloc instead of complicate memset to 0
1 parent 5337172 commit f0fb9e3

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

ext/spl/spl_directory.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,7 @@ static zend_object *spl_filesystem_object_new(zend_class_entry *class_type)
186186
{
187187
spl_filesystem_object *intern;
188188

189-
intern = emalloc(sizeof(spl_filesystem_object) + zend_object_properties_size(class_type));
190-
memset(intern, 0,
191-
MAX(XtOffsetOf(spl_filesystem_object, u.dir.entry),
192-
XtOffsetOf(spl_filesystem_object, u.file.escape) + sizeof(int)));
189+
intern = ecalloc(1, sizeof(spl_filesystem_object) + zend_object_properties_size(class_type));
193190
/* intern->type = SPL_FS_INFO; done by set 0 */
194191
intern->file_class = spl_ce_SplFileObject;
195192
intern->info_class = spl_ce_SplFileInfo;

0 commit comments

Comments
 (0)