1 // $Id: Dirent_Selector.cpp 80826 2008-03-04 14:51:23Z wotte $
3 #include "ace/Dirent_Selector.h"
5 #if !defined (__ACE_INLINE__)
6 #include "ace/Dirent_Selector.inl"
7 #endif /* __ACE_INLINE__ */
9 #include "ace/OS_NS_dirent.h"
10 #include "ace/OS_NS_stdlib.h"
14 "$Id: Dirent_Selector.cpp 80826 2008-03-04 14:51:23Z wotte $")
16 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
18 // Construction/Destruction
20 ACE_Dirent_Selector::ACE_Dirent_Selector (void)
26 ACE_Dirent_Selector::~ACE_Dirent_Selector (void)
28 // Free up any allocated resources.
33 ACE_Dirent_Selector::open (const ACE_TCHAR
*dir
,
34 ACE_SCANDIR_SELECTOR sel
,
35 ACE_SCANDIR_COMPARATOR cmp
)
37 n_
= ACE_OS::scandir (dir
, &this->namelist_
, sel
, cmp
);
42 ACE_Dirent_Selector::close (void)
44 for (--n_
; n_
>= 0; --n_
)
46 #if defined (ACE_LACKS_STRUCT_DIR)
47 // Only the lacking-struct-dir emulation allocates this. Native
48 // scandir includes d_name in the dirent struct itself.
49 ACE_OS::free (this->namelist_
[n_
]->d_name
);
51 ACE_OS::free (this->namelist_
[n_
]);
54 ACE_OS::free (this->namelist_
);
59 ACE_END_VERSIONED_NAMESPACE_DECL