Browse Source

Clean up `unquote` code

gingerBill 1 year ago
parent
commit
9d84e00502
1 changed files with 1 additions and 1 deletions
  1. 1 1
      core/encoding/ini/ini.odin

+ 1 - 1
core/encoding/ini/ini.odin

@@ -82,7 +82,7 @@ Map :: distinct map[string]map[string]string
 
 
 load_map_from_string :: proc(src: string, allocator: runtime.Allocator, options := DEFAULT_OPTIONS) -> (m: Map, err: runtime.Allocator_Error) {
 load_map_from_string :: proc(src: string, allocator: runtime.Allocator, options := DEFAULT_OPTIONS) -> (m: Map, err: runtime.Allocator_Error) {
 	unquote :: proc(val: string) -> (string, runtime.Allocator_Error) {
 	unquote :: proc(val: string) -> (string, runtime.Allocator_Error) {
-		if strings.has_prefix(val, `"`) || strings.has_prefix(val, `'`) {
+		if len(val) > 0 && (val[0] == '"' || val[0] == '\'') {
 			v, allocated, ok := strconv.unquote_string(val)
 			v, allocated, ok := strconv.unquote_string(val)
 			if !ok {
 			if !ok {
 				return strings.clone(val)
 				return strings.clone(val)