diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-05-19 14:26:43 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-06-01 11:09:16 +0300 |
commit | 4973c6cff0166f66a57667d29ec5a12580ef9ba5 (patch) | |
tree | f1096be6ecd1ad658dab3c9307c73c46e686dcf7 | |
parent | 4805f6a8ee7ab47d5d785bce539ab6039c9328ee (diff) | |
download | libmicrohttpd-4973c6cff0166f66a57667d29ec5a12580ef9ba5.tar.gz libmicrohttpd-4973c6cff0166f66a57667d29ec5a12580ef9ba5.zip |
Simplified usage of the function name magic macros
-rw-r--r-- | src/include/mhd_options.h | 15 | ||||
-rw-r--r-- | src/microhttpd/connection.c | 8 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/include/mhd_options.h b/src/include/mhd_options.h index 5a5b7fee..821407a9 100644 --- a/src/include/mhd_options.h +++ b/src/include/mhd_options.h | |||
@@ -172,4 +172,19 @@ | |||
172 | #endif /* ! (MHD_ASAN_ACTIVE && HAVE_SANITIZER_ASAN_INTERFACE_H && | 172 | #endif /* ! (MHD_ASAN_ACTIVE && HAVE_SANITIZER_ASAN_INTERFACE_H && |
173 | (FUNC_ATTR_PTRCOMPARE_WORKS || FUNC_ATTR_NOSANITIZE_WORKS)) */ | 173 | (FUNC_ATTR_PTRCOMPARE_WORKS || FUNC_ATTR_NOSANITIZE_WORKS)) */ |
174 | 174 | ||
175 | |||
176 | /** | ||
177 | * Automatic string with the name of the current function | ||
178 | */ | ||
179 | #if defined(HAVE___FUNC__) | ||
180 | #define MHD_FUNC_ __func__ | ||
181 | #elif defined(HAVE___FUNCTION__) | ||
182 | #define MHD_FUNC_ __FUNCTION__ | ||
183 | #elif defined(HAVE___PRETTY_FUNCTION__) | ||
184 | #define MHD_FUNC_ __PRETTY_FUNCTION__ | ||
185 | #else | ||
186 | #define MHD_FUNC_ "**name unavailable**" | ||
187 | #endif | ||
188 | |||
189 | |||
175 | #endif /* MHD_OPTIONS_H */ | 190 | #endif /* MHD_OPTIONS_H */ |
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 7f07a867..859ca820 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -2564,7 +2564,7 @@ MHD_connection_update_event_loop_info (struct MHD_Connection *connection) | |||
2564 | #if DEBUG_STATES | 2564 | #if DEBUG_STATES |
2565 | MHD_DLOG (connection->daemon, | 2565 | MHD_DLOG (connection->daemon, |
2566 | _ ("In function %s handling connection at state: %s\n"), | 2566 | _ ("In function %s handling connection at state: %s\n"), |
2567 | __FUNCTION__, | 2567 | MHD_FUNC_, |
2568 | MHD_state_to_string (connection->state)); | 2568 | MHD_state_to_string (connection->state)); |
2569 | #endif | 2569 | #endif |
2570 | switch (connection->state) | 2570 | switch (connection->state) |
@@ -4198,7 +4198,7 @@ MHD_connection_handle_read (struct MHD_Connection *connection, | |||
4198 | #if DEBUG_STATES | 4198 | #if DEBUG_STATES |
4199 | MHD_DLOG (connection->daemon, | 4199 | MHD_DLOG (connection->daemon, |
4200 | _ ("In function %s handling connection at state: %s\n"), | 4200 | _ ("In function %s handling connection at state: %s\n"), |
4201 | __FUNCTION__, | 4201 | MHD_FUNC_, |
4202 | MHD_state_to_string (connection->state)); | 4202 | MHD_state_to_string (connection->state)); |
4203 | #endif | 4203 | #endif |
4204 | /* TODO: check whether the next 'switch()' really needed */ | 4204 | /* TODO: check whether the next 'switch()' really needed */ |
@@ -4292,7 +4292,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection) | |||
4292 | #if DEBUG_STATES | 4292 | #if DEBUG_STATES |
4293 | MHD_DLOG (connection->daemon, | 4293 | MHD_DLOG (connection->daemon, |
4294 | _ ("In function %s handling connection at state: %s\n"), | 4294 | _ ("In function %s handling connection at state: %s\n"), |
4295 | __FUNCTION__, | 4295 | MHD_FUNC_, |
4296 | MHD_state_to_string (connection->state)); | 4296 | MHD_state_to_string (connection->state)); |
4297 | #endif | 4297 | #endif |
4298 | switch (connection->state) | 4298 | switch (connection->state) |
@@ -4849,7 +4849,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
4849 | #if DEBUG_STATES | 4849 | #if DEBUG_STATES |
4850 | MHD_DLOG (daemon, | 4850 | MHD_DLOG (daemon, |
4851 | _ ("In function %s handling connection at state: %s\n"), | 4851 | _ ("In function %s handling connection at state: %s\n"), |
4852 | __FUNCTION__, | 4852 | MHD_FUNC_, |
4853 | MHD_state_to_string (connection->state)); | 4853 | MHD_state_to_string (connection->state)); |
4854 | #endif | 4854 | #endif |
4855 | switch (connection->state) | 4855 | switch (connection->state) |