Fix segfault on several devices

This commit is contained in:
topjohnwu 2019-01-22 17:19:10 -05:00
parent 118a9f224e
commit b7f69238a1

View File

@ -16,8 +16,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#define str_contains(s, ss) ((s).find(ss) != string::npos) #define str_contains(s, ss) ((ss) != nullptr && (s).find(ss) != string::npos)
#define str_starts(s, ss) ((s).compare(0, strlen(ss), ss) == 0) #define str_starts(s, ss) ((ss) != nullptr && (s).compare(0, strlen(ss), ss) == 0)
std::vector<std::string> file_to_vector(const char *filename); std::vector<std::string> file_to_vector(const char *filename);
char *strdup2(const char *s, size_t *size = nullptr); char *strdup2(const char *s, size_t *size = nullptr);