parser: fix variable scoping by defaulting to local scope in functions. (0.41.0)
This change addresses a critical issue where common variable names in library functions (like 'i', 'n', 'src') were being treated as globals by default, leading to state collisions and unexpected side effects across different files. Changes: - Modified `src/parser.c` to automatically treat new variables assigned within a function body as locals unless they were already declared as globals. - Introduced `sym_find` in the parser to distinguish between finding an existing global and creating a new one. - Reverted `lib/net/cgi.fun` to use standard, short variable names, confirming that they no longer interfere with the caller's scope. - Verified that explicit global updates still work if the variable was already defined at the top-level scope.
This commit is contained in:
parent
9bba1e34ec
commit
43ce9f83af
3 changed files with 48 additions and 33 deletions
|
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
project(fun VERSION 0.40.8 LANGUAGES C)
|
||||
project(fun VERSION 0.41.0 LANGUAGES C)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue