[PATCH] Segregate FreeBSD-specific parts from sanitizer_procmaps_linux.cc
Alexey Samsonov
vonosmas at gmail.com
Thu Jul 24 11:18:11 PDT 2014
I think it's better to first remove ReadHex/ReadDecimal in favor of ParseHex/ParseDecimal in a small separate change, and then proceed with this change.
================
Comment at: lib/sanitizer_common/sanitizer_procmaps_common.cc:38
@@ +37,3 @@
+ return (c >= '0' && c <= '9')
+ || (c >= 'a' && c <= 'f');
+}
----------------
This is weird you don't have (c >= 'A' && c <= 'F'), although these values are handled in ParseHex().
================
Comment at: lib/sanitizer_common/sanitizer_procmaps_common.cc:164
@@ +163,3 @@
+ if (IsHex(pos[0])) {
+ start = ReadHex(pos);
+ for (; *pos != '/' && *pos > '\n'; pos++) {}
----------------
I believe you can safely replace ReadHex with ParseHex here, and get rid of the former.
================
Comment at: lib/sanitizer_common/sanitizer_procmaps_common.cc:169
@@ +168,3 @@
+ for (; *pos < '0' || *pos > '9'; pos++) {}
+ uptr rss = ReadDecimal(pos) * 1024;
+ cb(start, rss, file, stats, stats_size);
----------------
... And replace this with ParseDecimal() for consistency.
================
Comment at: lib/sanitizer_common/sanitizer_procmaps_linux.cc:90
@@ -303,2 +89,2 @@
#endif // SANITIZER_FREEBSD || SANITIZER_LINUX
----------------
Fix comment near this #endif
http://reviews.llvm.org/D4555
More information about the llvm-commits
mailing list