Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-41646

Clean up MAX_DAY_NUMBER: duplicated untyped #define, unclear comment, C-style casts

    XMLWordPrintable

Details

    Description

      Cleanups in code that predates MDEV-25529, which moves part of it into sql/sql_time.h:

      • MAX_DAY_NUMBER is defined twice as an untyped #define 3652424L (sql/item_timefunc.cc, sql/sql_time.cc). Make it one typed static constexpr constant in a header.
      • Its comment "Daynumber from year 0 to 9999-12-31" reads like a count of days over a range. Suggest /** Day number of 9999-12-31, calc_daynr(9999, 12, 31) */.
      • The day-range check in date_add_interval() uses C-style (ulonglong) interval.day casts; use functional casts.

      Found during review of MDEV-25529 (https://github.com/MariaDB/server/pull/5294); the code predates that change.

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              sanja Oleksandr Byelkin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.