Skip to content

Commit a1badc8

Browse files
remove a bunch of fixed size MAX_STRINGLEN buffers
1 parent 99f594f commit a1badc8

21 files changed

Lines changed: 311 additions & 362 deletions

File tree

docpages/basic-language-reference/functions/string/BUFFERTOSTRINGS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ This ensures the resulting string contains no embedded null bytes.
5454

5555
## Errors
5656

57-
* Invalid memory address → error
58-
* Negative `length` → error
59-
* Encoded result exceeds `MAX_STRINGLEN` → error
57+
* Invalid memory address
58+
* Negative `length`
59+
* Encoded result is too large to allocate a string variable
6060

6161
---
6262

include/basic/defines.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*/
88
#define MAX_STRINGLEN 10240
99

10+
#define MAX_PATH_LEN 1024
11+
1012
/**
1113
* @brief Maximum stack depth for GOSUB, PROC, and FN calls.
1214
*

include/string.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ const char* gc_strdup(basic_ctx* ctx, const char* string);
208208
*
209209
* Performs a zero-copy concatenation (writing directly to the arena) to avoid
210210
* the overhead of stack-based temporary buffers and redundant string copies.
211-
* The operation is atomic: if the combined length exceeds MAX_STRINGLEN or
212-
* arena capacity, no memory is committed and NULL is returned.
211+
* The operation is atomic: if the combined length exceeds arena capacity,
212+
* no memory is committed and NULL is returned.
213213
*
214214
* The returned pointer remains valid until the next call to gc(), typically
215215
* invoked at the end of the current line execution.
@@ -237,8 +237,8 @@ const char* gc_try_concat(struct basic_ctx *ctx, const char* s1, const char* s2)
237237
* pointer, performing a single-pass copy into the BASIC string arena.
238238
*
239239
* Like gc_try_concat(), this operation is atomic: if the literal length
240-
* exceeds MAX_STRINGLEN or available arena space, the allocator pointer
241-
* is not advanced, and NULL is returned.
240+
* exceeds available arena space, the allocator pointer is not advanced,
241+
* and NULL is returned.
242242
*
243243
* @note
244244
* - This function handles the advancing of the internal tokenizer pointer

0 commit comments

Comments
 (0)