tests: Remove xcid_init in favor of make_xcid#2047
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the test suite by modernizing the way Connection IDs (CIDs) are initialized. Instead of using dedicated initialization functions, CIDs are now directly assigned using Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a nice refactoring that removes the xcid_init family of functions and replaces their usage with direct calls to the make_xcid macros. This simplifies the test code by removing a layer of abstraction. The changes are generally well-executed, but I've identified a potential logic change in one of the test helpers and a minor stylistic inconsistency regarding redundant casts. My review includes suggestions to address these points.
| conn_options opts; | ||
|
|
||
| dcid_init(&dcid); | ||
| dcid = (ngtcp2_cid)make_dcid(); |
There was a problem hiding this comment.
The cast (ngtcp2_cid) is redundant here because the make_dcid() macro already expands to a compound literal of type ngtcp2_cid. For consistency with other parts of the codebase where this cast is not used (e.g., in tests/ngtcp2_transport_params_test.c), it would be better to remove it.
This comment also applies to similar changes on lines 12265, 12300, and 12335 in this file, as well as in tests/ngtcp2_transport_params_test.c.
dcid = make_dcid();| ngtcp2_tpe_init_conn(tpe, conn); | ||
|
|
||
| rcid_init(&tpe->dcid); | ||
| tpe->dcid = (ngtcp2_cid)make_dcid(); |
There was a problem hiding this comment.
This change from rcid_init(&tpe->dcid) to tpe->dcid = (ngtcp2_cid)make_dcid() seems to introduce an unintended logic change. The rcid_init function was a wrapper for make_rcid(), but it has been replaced with make_dcid(). This changes the value being assigned to tpe->dcid.
If the intention was just to remove the rcid_init function, this should probably be make_rcid() instead.
Also, the cast (ngtcp2_cid) is redundant because the make_*() macros already expand to a compound literal of the correct type. It would be good to remove it for consistency.
tpe->dcid = make_rcid();
No description provided.