[6916] Fixed typos in spell checking code.
[getmangos.git] / dep / ACE_wrappers / ace / Dirent_Selector.cpp
blob8fcb5775b29e0b09b432900ba1ebf8d26af5da3b
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"
12 ACE_RCSID (ace,
13 Dirent_Selector,
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)
21 : namelist_ (0),
22 n_ (0)
26 ACE_Dirent_Selector::~ACE_Dirent_Selector (void)
28 // Free up any allocated resources.
29 this->close();
32 int
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);
38 return n_;
41 int
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);
50 #endif
51 ACE_OS::free (this->namelist_[n_]);
54 ACE_OS::free (this->namelist_);
55 this->namelist_ = 0;
56 return 0;
59 ACE_END_VERSIONED_NAMESPACE_DECL