[[ Cleanup ]] Cleanup MCName API#5913
Conversation
This patch renames the MCNameLookup function to MCNameLookupCaseless to make it clearer what the function is doing.
This patch fixes a number of incorrect uses of MCNameLookupCaseless which were not checking for a nullptr return before use.
1e1e3c6 to
505371a
Compare
|
@livecode-vulcan review ok 505371a |
|
💙 review by @livecodeali ok 505371a |
|
😞 test failure 505371a
|
This patch removes uses of MCNameDelete, replacing them with direct calls to MCValueRelease (which is all MCNameDelete did).
This patch replaces all uses of MCAutoNameRef with MCNewAutoNameRef.
This patch removes MCNameClone replacing its use with appropriate MCValueRetains.
This patch removes the MCNameLookupWithOldString and MCNameLookupWithCString functions.
This patch removes the MCNameCreateWithOldString function.
This patch removes the (unused) MCNameIsEqualToOldString function.
This patch renames the libfoundation function MCNameIsEqualTo(x,y) to MCNameIsEqualToCaseless to better reflect its semantics. All instances of MCNameIsEqualTo usage which is caseless have been changed to use that form.
This patch adds an MCNameIsEqualTo function which allows the type of comparison to be specified as a third argument.
This patch removes MCNameIsEqualToCString and replaces it MCStringIsEqualToCString(MCNameGetString(...), ...).
This patch removes uses of MCNameCreateWithCString. It either replaces them with MCNAME(), or with MCNameCreateWithNativeChars.
This patch changes mcstring.cpp so that it uses an array of pairs (cstring, namevar_ptr) to initialize the initial MCNameRefs used throughout the engine.
This patch removes the LCB map module which has never been used and also removes the hooks into MCArray created for its purpose.
This patch corrects the use of MCArrayFetch/Store value in the bitmap effect and gradient set/get property functions. Previously they were using kMCCompareExact as the argument to 'case_sensitive'. This has been replaced with ctxt.GetCaseSensitive().
This patch makes the legacy API MCNameGetAsIndex private as it is only used in the foundation-legacy.cpp file, by code which computes array extents.
This patch removes the MCNameGetCharAtIndex function, replacing it with MCStringGetNativeCharAtIndex(MCNameGetString(...), ...).
505371a to
6ce7603
Compare
|
@livecode-vulcan review ok 6ce7603 |
|
💙 review by @runrevmark ok 6ce7603 |
[[ Cleanup ]] Cleanup MCName API This patch cleans up the MCName API. It removes all MCName APIs in foundation-legacy.h - in particular MCAutoNameRef. Additionally, it reworks the way MCN_ and MCM_ constants are created - making it table-based so hopefully reducing code footprint a bit. Whilst a large patch, each individual cleanup is split up into separate commits - so I suggest looking at each individually. Note: Marked as WIP as it will need a patch merged in commercial before this.
|
This depends on https://github.com/livecode/livecode-private/pull/207 being merged first. |
|
😎 test success 6ce7603
|
|
I think we will have to merge this, update submodules and review the private repo PR won't we? Otherwise |
|
@runrevmark if |
|
@livecodeali : I'll do a test by updating the submodule in the private PR and getting it to run through CI - if that works, then we can merge both. |
|
@montegoulding Yeah - we can now change MCNewAutoNameRef to MCAutoNameRef - might be best done as a separate PR after this one is merged though. I'll take a look at the uses of MCNameLookupCaseless and see if the code is simpler if its in the more standard form. |
This patch cleans up the MCName API. It removes all MCName APIs in foundation-legacy.h - in particular MCAutoNameRef.
Additionally, it reworks the way MCN_ and MCM_ constants are created - making it table-based so hopefully reducing code footprint a bit.
Whilst a large patch, each individual cleanup is split up into separate commits - so I suggest looking at each individually.
Note: Marked as WIP as it will need a patch merged in commercial before this.