RESOLVED FIXED 250802
Remove duplicate isLeapYear
https://bugs.webkit.org/show_bug.cgi?id=250802
Summary Remove duplicate isLeapYear
Ahmad Saleem
Reported 2023-01-18 15:54:54 PST
Hi Team, I came across another refactoring patch to remove duplicate function: Blink Commit - https://chromium.googlesource.com/chromium/blink/+/ecbe8115cc1f014eb61dff29b96e405a0ab3ef51 WebKit Source - https://searchfox.org/wubkat/source/Source/WTF/wtf/DateMath.h#188 & https://searchfox.org/wubkat/source/Source/WebCore/platform/DateComponents.cpp#56 We have two functions exactly same, one is inline while another is static. Can we get rid of one? Thanks!
Attachments
Brent Fulgham
Comment 1 2023-01-18 16:23:47 PST
Yes! Use the one in WTF/DateMath.h and delete the other one.
Alexey Proskuryakov
Comment 2 2023-01-18 16:35:47 PST
It would be nice to move other generic functions as well, and unify duplicates (like daysInMonths in ISO8601.cpp). But that would be a much larger effort. static int maxDayOfMonth(int year, int month) static int dayOfWeek(int year, int month, int day)
Ahmad Saleem
Comment 3 2023-01-18 16:36:59 PST
(In reply to Alexey Proskuryakov from comment #2) > It would be nice to move other generic functions as well, and unify > duplicates (like daysInMonths in ISO8601.cpp). But that would be a much > larger effort. > > static int maxDayOfMonth(int year, int month) > static int dayOfWeek(int year, int month, int day) Should I create a bug for future?
Ahmad Saleem
Comment 4 2023-01-18 16:37:12 PST
(In reply to Brent Fulgham from comment #1) > Yes! Use the one in WTF/DateMath.h and delete the other one. Happy to do PR. :-)
Alexey Proskuryakov
Comment 5 2023-01-18 16:47:27 PST
> Should I create a bug for future? I personally wouldn't bother (refactoring ideas don't usually get acted on), but it wouldn't be unreasonable to do if you feel like it.
Ahmad Saleem
Comment 6 2023-01-18 16:54:12 PST
(In reply to Alexey Proskuryakov from comment #5) > > Should I create a bug for future? > > I personally wouldn't bother (refactoring ideas don't usually get acted on), > but it wouldn't be unreasonable to do if you feel like it. Not in near future (few weeks), still learning few bits around WebKit but in few months, I can explore it as a challenge. I will add it in my To-do Notes. :-)
Ahmad Saleem
Comment 7 2023-01-18 17:07:57 PST
EWS
Comment 8 2023-01-19 05:36:50 PST
Committed 259080@main (0b9c23b10f38): <https://commits.webkit.org/259080@main> Reviewed commits have been landed. Closing PR #8806 and removing active labels.
Radar WebKit Bug Importer
Comment 9 2023-01-19 05:37:16 PST
Note You need to log in before you can comment on or make changes to this bug.