Mir

Code review comment for lp:~afrantzis/mir/variable-length-serialization-buffers-1320187

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

59 + static void heap_deleter(unsigned char* b) { if (b != nullptr) delete[] b; }

It is safe to call delete[] with nullptr (and doing so avoids the test here as well as in the library)

~~~~

345 +struct LargeMessages : mir_test_framework::InProcessServer
346 +{
347 + LargeMessagesServerConfiguration large_messages_server_config;
348 +
349 + mir::DefaultServerConfiguration& server_config() override
350 + {
351 + return large_messages_server_config;
352 + }
353 +};
354
355 +struct ConnectionContext
356 +{
357 + mt::WaitObject connected;
358 + MirConnection* connection{nullptr};
359 +};
360 +
361 +void connection_callback(MirConnection* connection, void* context)
362 +{
363 + auto connection_context = static_cast<ConnectionContext*>(context);
364 + connection_context->connection = connection;
365 + connection_context->connected.notify_ready();
366 +}

You could avoid this (and some related code in the test body) by:

using LargeMessages = mir_test_framework::BasicClientServerFixture<LargeMessagesServerConfiguration>;

review: Approve

« Back to merge proposal