2 +--------------------------------------------------------------------+
3 | libmemcached - C/C++ Client Library for memcached |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted under the terms of the BSD license. |
7 | You should have received a copy of the license in a bundled file |
8 | named LICENSE; in case you did not receive a copy you can review |
9 | the terms online at: https://opensource.org/licenses/BSD-3-Clause |
10 +--------------------------------------------------------------------+
11 | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ |
12 | Copyright (c) 2020 Michael Wallner <mike@php.net> |
13 +--------------------------------------------------------------------+
25 # define assert_msg(__expr, __mesg) \
28 # define assert_vmsg(__expr, __mesg, ...) \
47 # include "libmemcached/backtrace.hpp"
49 # define assert_msg(__expr, __mesg) \
52 fprintf(stderr, "\n%s:%d Assertion \"%s\" failed for function \"%s\" likely for %s\n", \
53 __FILE__, __LINE__, #__expr, __func__, (#__mesg)); \
59 # define assert_vmsg(__expr, __mesg, ...) \
62 size_t ask = snprintf(0, 0, (__mesg), __VA_ARGS__); \
64 char *_error_message = (char *) alloca(sizeof(char) * ask); \
65 size_t _error_message_size = snprintf(_error_message, ask, (__mesg), __VA_ARGS__); \
66 fprintf(stderr, "\n%s:%d Assertion '%s' failed for function '%s' [ %.*s ]\n", __FILE__, \
67 __LINE__, #__expr, __func__, int(_error_message_size), _error_message); \