GNU libmicrohttpd  1.0.1
mhd_panic.c
Go to the documentation of this file.
1 /*
2  This file is part of libmicrohttpd
3  Copyright (C) 2007-2018 Daniel Pittman and Christian Grothoff
4  Copyright (C) 2014-2022 Evgeny Grin (Karlson2k)
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
29 #include "mhd_panic.h"
30 #include "platform.h"
31 #include "microhttpd.h"
32 
37 
42 
43 
53 _MHD_NORETURN static void
54 mhd_panic_std (void *cls,
55  const char *file,
56  unsigned int line,
57  const char *reason)
58 {
59  (void) cls; /* Mute compiler warning. */
60 #ifdef HAVE_MESSAGES
61  fprintf (stderr,
62  _ ("Fatal error in GNU libmicrohttpd %s:%u: %s\n"),
63  file,
64  line,
65  reason);
66 #else /* ! HAVE_MESSAGES */
67  (void) file; /* Mute compiler warning. */
68  (void) line; /* Mute compiler warning. */
69  (void) reason; /* Mute compiler warning. */
70 #endif
71  abort ();
72 }
73 
74 
93 _MHD_EXTERN void
95  void *cls)
96 {
97  if ((MHD_PanicCallback) NULL != cb)
98  mhd_panic = cb;
99  else
101 
102  mhd_panic_cls = cls;
103 }
void(* MHD_PanicCallback)(void *cls, const char *file, unsigned int line, const char *reason)
Definition: microhttpd.h:2634
_MHD_EXTERN void MHD_set_panic_func(MHD_PanicCallback cb, void *cls)
Definition: panic.c:56
#define NULL
Definition: reason_phrase.c:30
#define _(String)
Definition: mhd_options.h:42
#define _MHD_EXTERN
Definition: mhd_options.h:53
MHD_PanicCallback mhd_panic
Definition: mhd_panic.c:36
static _MHD_NORETURN void mhd_panic_std(void *cls, const char *file, unsigned int line, const char *reason)
Definition: mhd_panic.c:54
void * mhd_panic_cls
Definition: mhd_panic.c:41
MHD_panic() function and helpers.
public interface to libmicrohttpd
platform-specific includes for libmicrohttpd