use new macros to cleanup #ifndef NDEBUG as much as possible (libs edition)

This commit is contained in:
Paul Davis 2022-06-21 21:46:54 -06:00
parent 0004ca2c41
commit 0d9656ef82
14 changed files with 49 additions and 91 deletions

View file

@ -39,6 +39,9 @@
#include <assert.h>
#include <math.h>
#include <errno.h>
#include "pbd/assert.h"
#include "smf.h"
#include "smf_private.h"
@ -212,12 +215,9 @@ smf_event_new_textual(int type, const char *text)
event->midi_buffer[1] = type;
vlq_length = smf_format_vlq(event->midi_buffer + 2, MAX_VLQ_LENGTH - 2, text_length);
#ifndef NDEBUG
int copied_length =
#endif
snprintf((char *)event->midi_buffer + vlq_length + 2, event->midi_buffer_length - vlq_length - 2, "%s", text);
assert(copied_length == text_length);
int copied_length;
copied_length = snprintf((char *)event->midi_buffer + vlq_length + 2, event->midi_buffer_length - vlq_length - 2, "%s", text);
x_assert (copied_length, copied_length == text_length);
event->midi_buffer_length = 2 + vlq_length + text_length;