Skip to content

examples: omit forward declarations, apply misc fixes#20296

Closed
vszakats wants to merge 9 commits intocurl:masterfrom
vszakats:extidy
Closed

examples: omit forward declarations, apply misc fixes#20296
vszakats wants to merge 9 commits intocurl:masterfrom
vszakats:extidy

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jan 13, 2026

  • 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.

@vszakats vszakats changed the title examples: omit forward declarations and misc fixes examples: omit forward declarations, and misc fixes Jan 13, 2026
@vszakats vszakats changed the title examples: omit forward declarations, and misc fixes examples: omit forward declarations, apply misc fixes Jan 13, 2026
@vszakats vszakats closed this in 8680a07 Jan 13, 2026
@vszakats vszakats deleted the extidy branch January 13, 2026 18:38
@bagder
Copy link
Member

bagder commented Jan 19, 2026

@vszakats my feedback on the clang format style used on evhiperfifo.c:

The leading comments should be indented by one space

-This is purely a demo app, all retrieved data is simply discarded by the write
-callback.
+ This is purely a demo app, all retrieved data is simply discarded by the write
+ callback.

Continued C expressions should be indented two steps:

   int action = ((revents & EV_READ) ? CURL_POLL_IN : 0) |
-               ((revents & EV_WRITE) ? CURL_POLL_OUT : 0);
+    ((revents & EV_WRITE) ? CURL_POLL_OUT : 0);

I'm not saying we should change this now. I just want to highlight that I don't think this clang format config is perfect.

@vszakats
Copy link
Member Author

vszakats commented Jan 19, 2026

@vszakats my feedback on the clang format style used on evhiperfifo.c:

The leading comments should be indented by one space

-This is purely a demo app, all retrieved data is simply discarded by the write
-callback.
+ This is purely a demo app, all retrieved data is simply discarded by the write
+ callback.

I rarely let clang-format touch comments, and did not change these
in this PR. Also agree it's wrong as it is. But, I think single-space
indented comments isn't actually used in the source anywhere now
(after fixing a few outliers in a different PR just recently). Wouldn't this
rather be the one that matches the rest of code:

-This is purely a demo app, all retrieved data is simply discarded by the write
-callback.
+ * This is purely a demo app, all retrieved data is simply discarded by the write
+ * callback.

and have the * fence for all lines?

I used this to verify: git grep '^ [^ *]' ':**.c' ':**.h'

(only gipher.c has it, and another source, that I fixed locally last week,
but not pushed yet.)

Continued C expressions should be indented two steps:

   int action = ((revents & EV_READ) ? CURL_POLL_IN : 0) |
-               ((revents & EV_WRITE) ? CURL_POLL_OUT : 0);
+    ((revents & EV_WRITE) ? CURL_POLL_OUT : 0);

I'm not saying we should change this now. I just want to highlight that I don't think this clang format config is perfect.

Indeed, I gave in to clang-format in this case, because both were
already used in these sibling-examples, and went with its suggestion
to align them, and found this more readable, knowing that it's not the
preferred style. History had a little bit of both here, even within
the same file.

I'll be sticking to the other style.

@vszakats
Copy link
Member Author

PR fixing the comments (and more, I had pending locally): #20361

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants