And FINALLY fixed the NULL name error in uiRegisterControlType().

This commit is contained in:
Pietro Gagliardi 2019-06-15 21:38:21 -04:00
parent 0550e4bc00
commit 29ce809772
3 changed files with 6 additions and 2 deletions

View File

@ -48,6 +48,10 @@ uint32_t uiRegisterControlType(const char *name, const uiControlVtable *vtable,
if (!uiprivCheckInitializedAndThread())
return 0;
if (name == NULL) {
uiprivProgrammerErrorNullPointer("name", uiprivFunc);
return 0;
}
if (vtable == NULL) {
uiprivProgrammerErrorNullPointer("uiControlVtable", uiprivFunc);
return 0;

View File

@ -47,7 +47,7 @@ uint32_t uiRegisterControlType(const char *name, const uiControlVtable *vtable,
`uiRegisterControlType()` registers a new `uiControl` type with the given vtables and returns its ID as passed to `uiNewControl()`. `implDataSize` is the size of the implementation data struct that is created by `uiNewControl()`.
Each type has a name, passed in the `name` parameter. The type name is only used for debugging and error reporting purposes. The type name is copied into libui-internal memory; the `name` pointer passed to `uiRegisterControlType()` is not used after it returns.
Each type has a name, passed in the `name` parameter. The type name is only used for debugging and error reporting purposes. The type name is copied into libui-internal memory; the `name` pointer passed to `uiRegisterControlType()` is not used after it returns. It is a programmer error to specify `NULL` for `name`. (TODO anything else? Empty string? Duplicate name?)
`uiControlVtable` describes the functions of a `uiControl` common between platforms, and is discussed on this page. `uiControlOSVtable` describes functionst hat vary from OS to OS, and are described in the respective OS-specific uiControl implementation pages. The two vtables are copied into libui-internal memory; the vtable pointers passed to `uiRegisterControlType()` are not used after it returns.

View File

@ -7,7 +7,7 @@ static const struct checkErrorCase cases[] = {
[](void) {
uiRegisterControlType(NULL, NULL, NULL, 0);
},
"uiRegisterControlType(): invalid null pointer for uiControlOSVtable",
"uiRegisterControlType(): invalid null pointer for name",
},
{
"uiRegisterControlType() with NULL vtable",