diff options
| author | Congcong Kuo <congcong.kuo@gmail.com> | 2025-05-26 00:49:26 +0800 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2025-06-03 15:09:55 +0200 |
| commit | 4b9d14378fcc3d8dd4eea36b541fe87e198fd7b8 (patch) | |
| tree | 530ea4ad44c0c1bdd9d4c655627f7f60a8cf5c74 /nix/libutil | |
| parent | 8a6cf4fad6d6568940286adc4197f37a344d4e5a (diff) | |
daemon: Remove ‘singleton’ and replace ‘typedef’ with ‘using’ in ‘types.hh’
* nix/libutil/util.hh (singleton): Remove.
* nix/libstore/build.cc (DerivationGoal::startBuilder)
(SubstitutionGoal::tryNext, SubstitutionGoal::tryToRun)
(LocalStore::ensurePath, LocalStore::repairPath): Use normal
construction function instead of ‘singleton’.
* nix/libstore/local-store.cc (LocalStore::addToStoreFromDump)
(LocalStore::addTextToStore, LocalStore::importPath): Likewise.
* nix/nix-daemon/nix-daemon.cc (performOp): Likewise.
Change-Id: If0d929407c09482f3b506a1c51dfda70e29696dd
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'nix/libutil')
| -rw-r--r-- | nix/libutil/types.hh | 14 | ||||
| -rw-r--r-- | nix/libutil/util.hh | 9 |
2 files changed, 7 insertions, 16 deletions
diff --git a/nix/libutil/types.hh b/nix/libutil/types.hh index 160884ee1ad..62889e6fa99 100644 --- a/nix/libutil/types.hh +++ b/nix/libutil/types.hh | |||
| @@ -76,24 +76,24 @@ public: | |||
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | 78 | ||
| 79 | typedef list<string> Strings; | 79 | using Strings = std::list<std::string>; |
| 80 | typedef set<string> StringSet; | 80 | using StringSet = std::set<std::string>; |
| 81 | 81 | ||
| 82 | 82 | ||
| 83 | /* Paths are just strings. */ | 83 | /* Paths are just strings. */ |
| 84 | typedef string Path; | 84 | using Path = std::string; |
| 85 | typedef list<Path> Paths; | 85 | using Paths = std::list<Path>; |
| 86 | typedef set<Path> PathSet; | 86 | using PathSet = std::set<Path>; |
| 87 | 87 | ||
| 88 | 88 | ||
| 89 | typedef enum { | 89 | enum Verbosity { |
| 90 | lvlError = 0, | 90 | lvlError = 0, |
| 91 | lvlInfo, | 91 | lvlInfo, |
| 92 | lvlTalkative, | 92 | lvlTalkative, |
| 93 | lvlChatty, | 93 | lvlChatty, |
| 94 | lvlDebug, | 94 | lvlDebug, |
| 95 | lvlVomit | 95 | lvlVomit |
| 96 | } Verbosity; | 96 | }; |
| 97 | 97 | ||
| 98 | 98 | ||
| 99 | } | 99 | } |
diff --git a/nix/libutil/util.hh b/nix/libutil/util.hh index 03234e3a5d2..176247e699d 100644 --- a/nix/libutil/util.hh +++ b/nix/libutil/util.hh | |||
| @@ -121,15 +121,6 @@ Paths createDirs(const Path & path); | |||
| 121 | void createSymlink(const Path & target, const Path & link); | 121 | void createSymlink(const Path & target, const Path & link); |
| 122 | 122 | ||
| 123 | 123 | ||
| 124 | template<class T, class A> | ||
| 125 | T singleton(const A & a) | ||
| 126 | { | ||
| 127 | T t; | ||
| 128 | t.insert(a); | ||
| 129 | return t; | ||
| 130 | } | ||
| 131 | |||
| 132 | |||
| 133 | /* Messages. */ | 124 | /* Messages. */ |
| 134 | 125 | ||
| 135 | 126 | ||
