diff options
Diffstat (limited to 'src/Directory.hxx')
-rw-r--r-- | src/Directory.hxx | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/src/Directory.hxx b/src/Directory.hxx index 380a6b790..54dd58f1c 100644 --- a/src/Directory.hxx +++ b/src/Directory.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -26,6 +26,8 @@ #include "DatabaseVisitor.hxx" #include "PlaylistVector.hxx" +#include <string> + #include <sys/types.h> #define DEVICE_INARCHIVE (dev_t)(-1) @@ -82,42 +84,22 @@ struct Directory { ino_t inode; dev_t device; bool have_stat; /* not needed if ino_t == dev_t == 0 is impossible */ - char path[sizeof(long)]; - -protected: - Directory(const char *path); - gcc_malloc gcc_nonnull_all - static Directory *Allocate(const char *path); + std::string path; public: - /** - * Default constructor, needed for #detached_root. - */ - Directory(); + Directory(const char *_path_utf8, Directory *_parent); ~Directory(); /** - * Generic constructor for #Directory object. - */ - gcc_malloc - static Directory *NewGeneric(const char *path_utf8, Directory *parent); - - /** * Create a new root #Directory object. */ gcc_malloc static Directory *NewRoot() { - return NewGeneric("", nullptr); + return new Directory("", nullptr); } /** - * Free this #Directory object (and the whole object tree within it), - * assuming it was already removed from the parent. - */ - void Free(); - - /** * Remove this #Directory object from its parent and free it. This * must not be called with the root Directory. * @@ -178,7 +160,7 @@ public: gcc_pure const char *GetPath() const { - return path; + return path.c_str(); } /** |