refactor(3p/nix/libutil): Replace string2Int & trim functions
Replaces these functions with corresponding functions from Abseil, namely absl::StripAsciiWhitespace and absl::SimpleAtoi. In the course of doing this some minor things I encountered along the way were also refactored. This also changes the signatures of the various custom readFile functions to use absl::string_view types.
This commit is contained in:
parent
b371821db5
commit
98299da0fd
19 changed files with 84 additions and 72 deletions
3
third_party/nix/src/libstore/local-store.cc
vendored
3
third_party/nix/src/libstore/local-store.cc
vendored
|
|
@ -7,6 +7,7 @@
|
|||
#include <ctime>
|
||||
#include <iostream>
|
||||
|
||||
#include <absl/strings/numbers.h>
|
||||
#include <fcntl.h>
|
||||
#include <glog/logging.h>
|
||||
#include <grp.h>
|
||||
|
|
@ -295,7 +296,7 @@ int LocalStore::getSchema() {
|
|||
int curSchema = 0;
|
||||
if (pathExists(schemaPath)) {
|
||||
std::string s = readFile(schemaPath);
|
||||
if (!string2Int(s, curSchema)) {
|
||||
if (!absl::SimpleAtoi(s, &curSchema)) {
|
||||
throw Error(format("'%1%' is corrupt") % schemaPath);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue