examples: omit forward declarations, apply misc fixes

- reorder functions to not need forward declarations.
- sync `ephiperfifo.c` and `evhiperfifo.c`.
- drop redundant casts for `calloc()` return value.
- ephiperfifo: silence unused variable warning.
- fix indent and apply clang-format more.

Closes #20296
This commit is contained in:
Viktor Szakats 2026-01-13 18:17:42 +01:00
parent df246eeb8f
commit 8680a07589
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
6 changed files with 158 additions and 161 deletions

View file

@ -22,7 +22,7 @@
*
***************************************************************************/
/* <DESC>
* multi socket API usage together with glib2
* multi socket API usage with glib2
* </DESC>
*/
/* Example application source code using the multi socket interface to
@ -194,9 +194,8 @@ static gboolean event_cb(GIOChannel *ch, GIOCondition condition, gpointer data)
CURLMcode mresult;
int fd = g_io_channel_unix_get_fd(ch);
int action =
((condition & G_IO_IN) ? CURL_CSELECT_IN : 0) |
((condition & G_IO_OUT) ? CURL_CSELECT_OUT : 0);
int action = ((condition & G_IO_IN) ? CURL_CSELECT_IN : 0) |
((condition & G_IO_OUT) ? CURL_CSELECT_OUT : 0);
mresult = curl_multi_socket_action(g->multi, fd, action, &g->still_running);
mcode_or_die("event_cb: curl_multi_socket_action", mresult);
@ -230,9 +229,8 @@ static void remsock(struct SockInfo *f)
static void setsock(struct SockInfo *f, curl_socket_t s, CURL *e, int act,
struct GlobalInfo *g)
{
GIOCondition kind =
((act & CURL_POLL_IN) ? G_IO_IN : 0) |
((act & CURL_POLL_OUT) ? G_IO_OUT : 0);
GIOCondition kind = ((act & CURL_POLL_IN) ? G_IO_IN : 0) |
((act & CURL_POLL_OUT) ? G_IO_OUT : 0);
f->sockfd = s;
f->action = act;