Lots of work on removing malloc from driver

This commit is contained in:
2022-02-17 20:02:08 -05:00
parent 9d7bf8b0f9
commit 467f25b927
17 changed files with 1301 additions and 197 deletions

View File

@@ -2,6 +2,7 @@
#define UTIL_HPP
#include <string>
#include <string_view>
#include <set>
#include <map>
#include <algorithm>
@@ -99,10 +100,6 @@ int64_t strtoint(const std::string &value, int64_t errval);
// String to double. Returns NAN if the number is not parseable.
double strtodouble(const std::string &value);
// Split a string of the form "hostname:port" into a hostname and a port.
// On failure, returns empty strings.
void split_host_port(const std::string &target, std::string &host, std::string &port);
// Trim strings: left end, right end, both ends.
std::string ltrim(std::string s);
std::string rtrim(std::string s);
@@ -120,6 +117,9 @@ LuaSourcePtr make_lua_source(const std::string &code);
// Return true if the line of code is a lua comment.
bool is_lua_comment(const std::string &line);
// This has to go away.
LuaSourcePtr read_lua_source(const std::string &dir);
// Remove nullptrs from a vector of unique pointers.
template<class T>
void remove_nullptrs(std::vector<std::unique_ptr<T>> &vec) {
@@ -128,9 +128,6 @@ void remove_nullptrs(std::vector<std::unique_ptr<T>> &vec) {
vec.erase(iter, vec.end());
}
// Read the lua source code from the specified directory.
LuaSourcePtr read_lua_source(const std::string &directory);
// An XYZ coordinate, general purpose.
struct XYZ {
float x, y, z;