On Wed, 20 Dec 2023 10:40:00 +1030, Qu Wenruo wrote:[...]
----
Changelog:
v2:
- Use enum bitmap to describe the suffixes
This gets rid of the upper/lower case problem, and enum makes it
a little more readable.
- Fix the suffix overflow detection
- Move the left shift out of the switch block
- Remove the "done" tag
Since no tailing character can already be handled properly.
nit: git am puts this changelog in the commit message when applied.
Please use `git send-email --annotate` and put it next to the diffstat,
so that it gets discarded.
+};
+
+/*
+ * The default suffix list would not include "E" since it's too easy to overflow
+ * and not much real world usage.
+ */
^ this comment is a duplicate.
+#define KSTRTOULL_SUFFIX_DEFAULT (SUFFIX_K | SUFFIX_M | SUFFIX_G | SUFFIX_T | SUFFIX_P)
I think it'd be clearer if you dropped this default and had callers
explicitly provide the desired suffix mask.
With the above changes made, feel free to add
Reviewed-by: David Disseldorp <ddiss@xxxxxxx>
I'll leave the review of patch 2/2 up to others, as I'm still a little
worried about sysfs trailing whitespace regressions.