diff options
| author | gingerBill <bill@gingerbill.org> | 2019-05-25 20:24:19 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-05-25 20:24:19 +0100 |
| commit | 458ec5922e69f105ca92d348e475693dfa252ad0 (patch) | |
| tree | 0c7db7614a6a3f9d05816e54adc03d82118f06c3 /src/string.cpp | |
| parent | f5fdd031f9b763a2b6a86f2fc536735fc8d7ed5d (diff) | |
odin query
Output .json file containing information about the program
Diffstat (limited to 'src/string.cpp')
| -rw-r--r-- | src/string.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/string.cpp b/src/string.cpp index 39219789f..774061edf 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -562,19 +562,20 @@ bool unquote_char(String s, u8 quote, Rune *rune, bool *multiple_bytes, String * // 0 == failure // 1 == original memory // 2 == new allocation -i32 unquote_string(gbAllocator a, String *s_) { +i32 unquote_string(gbAllocator a, String *s_, u8 quote=0) { String s = *s_; isize n = s.len; - u8 quote; - if (n < 2) { - return 0; - } - quote = s[0]; - if (quote != s[n-1]) { - return 0; + if (quote == 0) { + if (n < 2) { + return 0; + } + quote = s[0]; + if (quote != s[n-1]) { + return 0; + } + s.text += 1; + s.len -= 2; } - s.text += 1; - s.len -= 2; if (quote == '`') { if (string_contains_char(s, '`')) { |