Skip to content

Add helpful comments.#87

Open
Lightning11wins wants to merge 3 commits intomasterfrom
add-comments
Open

Add helpful comments.#87
Lightning11wins wants to merge 3 commits intomasterfrom
add-comments

Conversation

@Lightning11wins
Copy link
Contributor

Changes extracted from #85. Should not affect logic. Review should be very easy.

Add comment to clarify that DateTime->Value is not seconds since the epoch.
Add comments clarifying confusing details in the DateTime structure.
Add comment to explain what the qpf_grow_fn_t() type is, used by qprintf.
@Lightning11wins Lightning11wins self-assigned this Mar 4, 2026
@Lightning11wins Lightning11wins added enhancement ai-review Request AI review of this PR labels Mar 4, 2026
@greptile-apps
Copy link

greptile-apps bot commented Mar 4, 2026

Greptile Summary

This PR adds clarifying comments to two header files without altering any logic — exactly as described. The changes improve developer understanding of the DateTime bitfield layout and the qpf_grow_fn_t callback signature.

Key changes:

  • datatypes.h: Each DateTime.Part member now documents its encoding scheme (0-based, 1900-based), and the Value field notes it is not a Unix epoch timestamp. All comments are consistent with actual usage across the codebase (e.g., Year+1900 in htdrv_datetime.c, tm_mon assigned directly to Month, tm_mday - 1 assigned to Day).
  • qprintf.h: Named parameters are added to the qpf_grow_fn_t function-pointer typedef (str, size, offset, args, req), along with a Javadoc-style block comment. The descriptions match the semantics used in every concrete implementation of this callback (htr_internal_GrowFn, qpfPrintf_grow, etc.).

Confidence Score: 5/5

  • This PR is safe to merge — it contains only comment additions with no logic changes.
  • All new comments were verified against actual usage sites in the codebase and are accurate. No executable code was modified.
  • No files require special attention.

Important Files Changed

Filename Overview
centrallix-lib/include/datatypes.h Adds inline comments to all DateTime bitfield members and the Value field; comments are accurate per codebase evidence (Year is 1900-based, Month/Day/Hour/Minute/Second are 0-based, Value is not a Unix timestamp).
centrallix-lib/include/qprintf.h Adds named parameters to the qpf_grow_fn_t function-pointer typedef and a Javadoc-style comment block; parameter names and descriptions match actual implementations (e.g., htr_internal_GrowFn, qpfPrintf_grow).

Sequence Diagram

sequenceDiagram
    participant Caller
    participant qpfPrintf_va_internal
    participant qpf_grow_fn_t

    Caller->>qpfPrintf_va_internal: qpfPrintf_va_internal(s, &str, &size, grow_fn, grow_arg, format, ap)
    loop For each format specifier
        qpfPrintf_va_internal->>qpfPrintf_va_internal: Check if buffer is large enough
        alt Buffer too small
            qpfPrintf_va_internal->>qpf_grow_fn_t: grow_fn(&str, &size, offset, args, req)
            qpf_grow_fn_t-->>qpfPrintf_va_internal: 1 (success) / 0 (failure)
        end
        qpfPrintf_va_internal->>qpfPrintf_va_internal: Write formatted output to str
    end
    qpfPrintf_va_internal-->>Caller: bytes written (or -1 on error)
Loading

Last reviewed commit: f19429f

@Lightning11wins
Copy link
Contributor Author

@greptileai Please re-review this PR and let me know if you have any other comments, or let me know if the PR is ready to merge.

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

Labels

ai-review Request AI review of this PR enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant