Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit cd3a8e0

Browse files
committed
libfoundation: Add type checks to exported MCName functions
1 parent f1fd50a commit cd3a8e0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libfoundation/src/foundation-name.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ MCNameRef MCNAME(const char *p_string)
5555

5656
bool MCNameCreate(MCStringRef p_string, MCNameRef& r_name)
5757
{
58-
MCAssert(p_string != nil);
58+
__MCAssertIsString(p_string);
5959

6060
if (p_string -> char_count == 0 && kMCEmptyName != nil)
6161
{
@@ -233,11 +233,13 @@ MCNameRef MCNameLookup(MCStringRef p_string)
233233

234234
uintptr_t MCNameGetCaselessSearchKey(MCNameRef self)
235235
{
236+
__MCAssertIsName(self);
236237
return (uintptr_t)self -> key;
237238
}
238239

239240
MCStringRef MCNameGetString(MCNameRef self)
240241
{
242+
__MCAssertIsName(self);
241243
return self -> string;
242244
}
243245

@@ -248,6 +250,9 @@ bool MCNameIsEmpty(MCNameRef self)
248250

249251
bool MCNameIsEqualTo(MCNameRef self, MCNameRef p_other_name)
250252
{
253+
__MCAssertIsName(self);
254+
__MCAssertIsName(p_other_name);
255+
251256
return self == p_other_name ||
252257
self -> key == p_other_name -> key;
253258
}

0 commit comments

Comments
 (0)