228916bcec
Unify error handling in ClipboardInitFormats() and actually handle the return value of ClipboardInitSynthesizers(). Currently it always returns TRUE, but this may change, so we'd better be clean. Declare 'formatName' in wClipboardFormat as non-const. It is customary in C to declare owned pointers as non-const because various deallocation functions like free() take non-const pointers as arguments. Furthermore, const char* is tightly associated with "string literals" which must not be freed. Thus declaring this field as non-const is more accurate, and removes that ugly void* cast from ClipboardInitFormats(). Unify error handling in ClipboardCreate(). The cleanup snippet should not be repeated as it's prone to errors, like leaking the allocation of clipboard->formats when ClipboardInitFormats() fails. Unified error handling makes it much harder to forget resource cleanup on errors. |
||
---|---|---|
.. | ||
test | ||
clipboard.c | ||
clipboard.h | ||
CMakeLists.txt | ||
ModuleOptions.cmake | ||
synthetic.c |