New upstream version 21.0.2+dfsg1
This commit is contained in:
parent
1f1bbb3518
commit
baafb6325b
706 changed files with 49633 additions and 5044 deletions
28
deps/obs-scripting/cstrcache.cpp
vendored
Normal file
28
deps/obs-scripting/cstrcache.cpp
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include <unordered_map>
|
||||
#include <string>
|
||||
|
||||
#include "cstrcache.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct const_string_table {
|
||||
unordered_map<string, string> strings;
|
||||
};
|
||||
|
||||
static struct const_string_table table;
|
||||
|
||||
const char *cstrcache_get(const char *str)
|
||||
{
|
||||
if (!str || !*str)
|
||||
return "";
|
||||
|
||||
auto &strings = table.strings;
|
||||
auto pair = strings.find(str);
|
||||
|
||||
if (pair == strings.end()) {
|
||||
strings[str] = str;
|
||||
pair = strings.find(str);
|
||||
}
|
||||
|
||||
return pair->second.c_str();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue