[PATCH -perfbook 1/2] toolsoftrade: Fix up conventions around VerbatimT
Akira Yokosawa <[email protected]> Sun, 28 Jun 2026 19:10:31 +0900
| Newsgroups | org.kernel.vger.perfbook |
|---|---|
| Message-ID | <[email protected]> |
After the convention introduced in commit b29ee7777f33 ("Redefine
line count format at the beginning of VerbatimT env"), redefine
\myfvline in front of \begin{VerbatimT}.
This restores custom form of line counts in Listing 4.14 such
as "A1", "B2", "C3", etc.
Remove \fvset{} which is now redundant as well.
Signed-off-by: Akira Yokosawa <[email protected]>
---
toolsoftrade/toolsoftrade.tex | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/toolsoftrade/toolsoftrade.tex b/toolsoftrade/toolsoftrade.tex
index d83e55f2..08efff11 100644
--- a/toolsoftrade/toolsoftrade.tex
+++ b/toolsoftrade/toolsoftrade.tex
@@ -1487,24 +1487,19 @@ A short answer to this question is ``they lived dangerously''.
\begin{listing}[tb]
\begin{adjustwidth}{10pt}{5pt}
\footnotesize
-\fvset{numbers=left,numbersep=5pt,fontsize=\scriptsize,frame=single,xrightmargin=5pt}
-{\renewcommand{\theFancyVerbLine}{%
- {\rmfamily\tiny A\arabic{FancyVerbLine}}}
+\renewcommand{\myfvline}{A\arabic{FancyVerbLine}}
\begin{VerbatimT}
ptr = global_ptr;
if (ptr != NULL && ptr < high_address)
do_low(ptr);
\end{VerbatimT}
-}
Might be transformed to:
-{\renewcommand{\theFancyVerbLine}{%
- {\rmfamily\tiny B\arabic{FancyVerbLine}}}
+\renewcommand{\myfvline}{B\arabic{FancyVerbLine}}
\begin{VerbatimT}
if (global_ptr != NULL &&
global_ptr < high_address)
do_low(global_ptr);
\end{VerbatimT}
-}
The compiler assumes normal variables do not spontaneously change,
the surrounding code might use many machine registers, and this
transformation reduces register pressure.
@@ -1513,14 +1508,12 @@ to \co{NULL} between lines~B1 and~B2 of the transformed code, the
two comparisons will be against different variables, possibly passing
\co{do_low} a \co{NULL} pointer.
Prevent this by using \co{READ_ONCE()} as follows:
-{\renewcommand{\theFancyVerbLine}{%
- {\rmfamily\tiny C\arabic{FancyVerbLine}}}
+\renewcommand{\myfvline}{C\arabic{FancyVerbLine}}
\begin{VerbatimT}
ptr = READ_ONCE(global_ptr);
if (ptr != NULL && ptr < high_address)
do_low(ptr);
\end{VerbatimT}
-}
\end{adjustwidth}
\caption{Living Dangerously Early 1990s Style}
\label{lst:toolsoftrade:Living Dangerously Early 1990s Style}
base-commit: f7fdd691fd80b87b08719f1faad5059105712f37
--
2.43.0