From 458ec5922e69f105ca92d348e475693dfa252ad0 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 25 May 2019 20:24:19 +0100 Subject: odin query Output .json file containing information about the program --- src/string.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/string.cpp') 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, '`')) { -- cgit v1.2.3