You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removed unnecessary const_cast by fixing function signatures:
1. TString::equals const-correctness (4 casts eliminated)
- Changed signature: bool equals(const TString*) const
- Removed const_cast from lobject.h lines 1866, 1885, 1922
- Method only reads data, should be const
2. luaH_size const-correctness (1 cast eliminated)
- Changed signature: lu_mem luaH_size(const Table*)
- Also made sizehash() const-correct
- Removed const_cast from Table::size()
3. global_State logical mutability (1 cast eliminated)
- Marked l_G field as mutable in lua_State
- GC can happen during any operation, even const ones
- Updated getGlobalState() const to return non-const
- Removed const_cast from G() helper function
4. Udata::getMemory const-correctness (1 cast eliminated)
- getudatamem() already had const overload
- Removed unnecessary const_cast by calling correct overload
Benefits:
- Better const-correctness throughout codebase
- Eliminated 7 unnecessary const_casts
- More accurate API contracts (const means read-only)
- Zero performance impact
Performance: 2.35s avg (44% faster than 4.20s baseline)
All tests passing: "final OK !!!"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
0 commit comments