assert.c 967 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* $OpenLDAP$ */
  2. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  3. *
  4. * Copyright 1998-2024 The OpenLDAP Foundation.
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted only as authorized by the OpenLDAP
  9. * Public License.
  10. *
  11. * A copy of this license is available in the file LICENSE in the
  12. * top-level directory of the distribution or, alternatively, at
  13. * <http://www.OpenLDAP.org/license.html>.
  14. */
  15. #include "portable.h"
  16. #ifdef LDAP_NEED_ASSERT
  17. #include <stdio.h>
  18. /*
  19. * helper for our private assert() macro
  20. *
  21. * note: if assert() doesn't exist, like abort() or raise() won't either.
  22. * could use kill() but that might be problematic. I'll just ignore this
  23. * issue for now.
  24. */
  25. void
  26. ber_pvt_assert( const char *file, int line, const char *test )
  27. {
  28. fprintf(stderr,
  29. _("Assertion failed: %s, file %s, line %d\n"),
  30. test, file, line);
  31. abort();
  32. }
  33. #endif