Skip to content

Make non-mutated pointers const #545

@Davichet-e

Description

@Davichet-e

Current Issue
Right now, there are many functions which parameters pointers could be const. Example:

temporal_time_split(Temporal *temp, Interval *duration, TimestampTz torigin,

Why is it relevant

  1. Readability from the code as such, since if you see the const, you know that by convention that variable won't be changed.
  2. Wrapper improvement. The code needed to create the wrapper in Rust will be cleaner, since in Rust, if the pointer type it's specified as const, the type generated by bindgen (the tool that takes C headers and generates the Rust equivalents), is const *T, whereas if const it's not specified, it outputs mut *T, this means that for functions where I wouldn't need to pass a mutable reference, I still need to.

Describe the solution you'd like
For every pointer type received as a parameter, if it's not modified, add a const modifier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions