home / secrets / src / util / require.c

require.c



//
//  require.c
//  fornax2_core
//
//  Created by Anders on 11/04/2019.
//

#include "require.h"

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>


__attribute__((__format__ (__printf__, 2, 0)))
void require(bool state, const char* message, ...) {
  if (state) return;
  
  va_list arglist;
  va_start( arglist, message );
  vprintf(message, arglist);
  va_end( arglist );
  
  assert(false);
  exit(EXIT_FAILURE);
}