Browse Source

Builder makes added caller location

Pix 2 years ago
parent
commit
0cf9c22033
1 changed files with 12 additions and 12 deletions
  1. 12 12
      core/strings/builder.odin

+ 12 - 12
core/strings/builder.odin

@@ -35,8 +35,8 @@ Returns:
 - res: The new Builder
 - err: An optional allocator error if one occured, `nil` otherwise
 */
-builder_make_none :: proc(allocator := context.allocator) -> (res: Builder, err: mem.Allocator_Error) #optional_allocator_error {
-	return Builder{buf=make([dynamic]byte, allocator) or_return }, nil
+builder_make_none :: proc(allocator := context.allocator, loc := #caller_location) -> (res: Builder, err: mem.Allocator_Error) #optional_allocator_error {
+	return Builder{buf=make([dynamic]byte, allocator, loc) or_return }, nil
 }
 /*
 Produces a Builder with a specified length and cap of max(16,len) byte buffer
@@ -51,8 +51,8 @@ Returns:
 - res: The new Builder
 - err: An optional allocator error if one occured, `nil` otherwise
 */
-builder_make_len :: proc(len: int, allocator := context.allocator) -> (res: Builder, err: mem.Allocator_Error) #optional_allocator_error {
-	return Builder{buf=make([dynamic]byte, len, allocator) or_return }, nil
+builder_make_len :: proc(len: int, allocator := context.allocator, loc := #caller_location) -> (res: Builder, err: mem.Allocator_Error) #optional_allocator_error {
+	return Builder{buf=make([dynamic]byte, len, allocator, loc) or_return }, nil
 }
 /*
 Produces a Builder with a specified length and cap
@@ -68,8 +68,8 @@ Returns:
 - res: The new Builder
 - err: An optional allocator error if one occured, `nil` otherwise
 */
-builder_make_len_cap :: proc(len, cap: int, allocator := context.allocator) -> (res: Builder, err: mem.Allocator_Error) #optional_allocator_error {
-	return Builder{buf=make([dynamic]byte, len, cap, allocator) or_return }, nil
+builder_make_len_cap :: proc(len, cap: int, allocator := context.allocator, loc := #caller_location) -> (res: Builder, err: mem.Allocator_Error) #optional_allocator_error {
+	return Builder{buf=make([dynamic]byte, len, cap, allocator, loc) or_return }, nil
 }
 /*
 Produces a String Builder
@@ -116,8 +116,8 @@ Returns:
 - res: A pointer to the initialized Builder
 - err: An optional allocator error if one occured, `nil` otherwise
 */
-builder_init_none :: proc(b: ^Builder, allocator := context.allocator) -> (res: ^Builder, err: mem.Allocator_Error) #optional_allocator_error {
-	b.buf = make([dynamic]byte, allocator) or_return
+builder_init_none :: proc(b: ^Builder, allocator := context.allocator, loc := #caller_location) -> (res: ^Builder, err: mem.Allocator_Error) #optional_allocator_error {
+	b.buf = make([dynamic]byte, allocator, loc) or_return
 	return b, nil
 }
 /*
@@ -135,8 +135,8 @@ Returns:
 - res: A pointer to the initialized Builder
 - err: An optional allocator error if one occured, `nil` otherwise
 */
-builder_init_len :: proc(b: ^Builder, len: int, allocator := context.allocator) -> (res: ^Builder, err: mem.Allocator_Error) #optional_allocator_error {
-	b.buf = make([dynamic]byte, len, allocator) or_return
+builder_init_len :: proc(b: ^Builder, len: int, allocator := context.allocator, loc := #caller_location) -> (res: ^Builder, err: mem.Allocator_Error) #optional_allocator_error {
+	b.buf = make([dynamic]byte, len, allocator, loc) or_return
 	return b, nil
 }
 /*
@@ -153,8 +153,8 @@ Returns:
 - res: A pointer to the initialized Builder
 - err: An optional allocator error if one occured, `nil` otherwise
 */
-builder_init_len_cap :: proc(b: ^Builder, len, cap: int, allocator := context.allocator) -> (res: ^Builder, err: mem.Allocator_Error) #optional_allocator_error {
-	b.buf = make([dynamic]byte, len, cap, allocator) or_return
+builder_init_len_cap :: proc(b: ^Builder, len, cap: int, allocator := context.allocator, loc := #caller_location) -> (res: ^Builder, err: mem.Allocator_Error) #optional_allocator_error {
+	b.buf = make([dynamic]byte, len, cap, allocator, loc) or_return
 	return b, nil
 }
 // Overload simple `builder_init_*` with or without len / ap parameters