CXStringSet *createSet(const std::vector<std::string> &Strings) { CXStringSet *Set = new CXStringSet; Set->Count = Strings.size(); Set->Strings = new CXString[Set->Count]; for (unsigned SI = 0, SE = Set->Count; SI < SE; ++SI) Set->Strings[SI] = createDup(Strings[SI]); return Set; }
CXString createRef(StringRef String) { // If the string is not nul-terminated, we have to make a copy. // This is doing a one past end read, and should be removed! if (!String.empty() && String.data()[String.size()] != 0) return createDup(String); CXString Result; Result.data = String.data(); Result.private_flags = (unsigned) CXS_Unmanaged; return Result; }
CXString createRef(StringRef String) { // If the string is not nul-terminated, we have to make a copy. // FIXME: This is doing a one past end read, and should be removed! For memory // we don't manage, the API string can become unterminated at any time outside // our control. if (!String.empty() && String.data()[String.size()] != 0) return createDup(String); CXString Result; Result.data = String.data(); Result.private_flags = (unsigned) CXS_Unmanaged; return Result; }