Re: [PATCH 07/16] docs/zh_TW: process: localize terminology in coding-style.rst
From: 葉宸佑
Date: Fri Jul 24 2026 - 02:39:00 EST
On Wed, Jul 22, 2026 at 10:48:26PM +0800, Weijie Yuan wrote:
> I would say splitting this part into a small patch is better. But for
> this time, it's fine.
Noted, and I agree. The kmalloc_objs()/kzalloc_objs() examples are an
API change rather than a terminology issue, so it would have been
cleaner as its own patch. I will keep content changes of that kind
separate in future work.
> Change to:
> ``GNU emacs`` 能自動幫你格式化 C 原始程式碼,而且你也注意到了,確實是這樣,
> 不過它所使用的預設值和我們想要的相去甚遠 ...
Will reflow this paragraph in v2, along with the rest of the lines
that grew after localization.
Thanks for the review.
Chen-Yu
Weijie Yuan <wy@xxxxxxxxx> 於 2026年7月22日週三 下午10:48寫道:
>
> On Wed, Jul 22, 2026 at 05:55:33AM +0800, Chen-Yu Yeh wrote:
> > Localize mainland terms to Taiwanese Mandarin (內核→核心, 函數→函式,
> > 宏→巨集, 枚舉→列舉, 聲明→宣告, 寄存器→暫存器, ...) and sync with the
> > English original: update the memory allocator list and array
> > allocation examples to the type-aware kmalloc_objs()/kzalloc_objs()
> > forms.
> >
> > update to commit 323fa4b9608b ("Documentation: Fix syntax of kmalloc_objs example in coding style doc")
> >
> > Signed-off-by: Chen-Yu Yeh <chenyou910331@xxxxxxxxx>
>
> Except the wrapping issue of the commit message (leave it to the
> maintainers to handle it):
>
> Reviewed-by: Weijie Yuan <wy@xxxxxxxxx>
>
> > ---
> > .../zh_TW/process/coding-style.rst | 580 +++++++++---------
> > 1 file changed, 292 insertions(+), 288 deletions(-)
> >
>
> [...]
>
> > 9) 你已經把事情弄糟了
> > ---------------------
> >
> > 這沒什麼,我們都是這樣。可能你長期使用 Unix 的朋友已經告訴你
> > -``GNU emacs`` 能自動幫你格式化 C 源代碼,而且你也注意到了,確實是這樣,不過它
> > -所使用的默認值和我們想要的相去甚遠 (實際上,甚至比隨機打的還要差——無數個猴子
> > -在 GNU emacs 裏打字永遠不會創造出一個好程序)
> > +``GNU emacs`` 能自動幫你格式化 C 原始程式碼,而且你也注意到了,確實是這樣,不過它
> > +所使用的預設值和我們想要的相去甚遠 (實際上,甚至比隨機打的還要差——無數個猴子
> > +在 GNU emacs 裡打字永遠不會創造出一個好程式)
>
> Change to:
>
> ``GNU emacs`` 能自動幫你格式化 C 原始程式碼,而且你也注意到了,確實是這樣,
> 不過它所使用的預設值和我們想要的相去甚遠 (實際上,甚至比隨機打的還要差——
> 無數個猴子在 GNU emacs 裡打字永遠不會創造出一個好程式)
>
> ?
>
> > *(譯註:Infinite Monkey Theorem)*
> >
> > 所以你要麼放棄 GNU emacs,要麼改變它讓它使用更合理的設定。要採用後一個方案,
> > -你可以把下面這段粘貼到你的 .emacs 文件裏。
> > +你可以把下面這段貼上到你的 .emacs 檔案裡。
> >
> > .. code-block:: elisp
> >
> > @@ -640,31 +641,31 @@ Documentation/translations/zh_CN/doc-guide/index.rst 和 tools/docs/kernel-doc
> > (expand-file-name "~/src/linux-trees")
> > 'linux-kernel)
> >
> > -這會讓 emacs 在 ``~/src/linux-trees`` 下的 C 源文件獲得更好的內核代碼風格。
> > +這會讓 emacs 在 ``~/src/linux-trees`` 下的 C 原始檔獲得更好的核心程式碼風格。
> >
> > -不過就算你嘗試讓 emacs 正確的格式化代碼失敗了,也並不意味着你失去了一切:還可
> > +不過就算你嘗試讓 emacs 正確的格式化程式碼失敗了,也並不意味著你失去了一切:還可
> > 以用 ``indent`` 。
> >
> > 不過,GNU indent 也有和 GNU emacs 一樣有問題的設定,所以你需要給它一些命令選
> > -項。不過,這還不算太糟糕,因爲就算是 GNU indent 的作者也認同 K&R 的權威性
> > +項。不過,這還不算太糟糕,因為就算是 GNU indent 的作者也認同 K&R 的權威性
> > (GNU 的人並不是壞人,他們只是在這個問題上被嚴重的誤導了),所以你只要給 indent
> > -指定選項 ``-kr -i8`` (代表 ``K&R,8 字符縮進``),或使用 ``scripts/Lindent``
> > -這樣就可以以最時髦的方式縮進源代碼。
> > +指定選項 ``-kr -i8`` (代表 ``K&R,8 字元縮排``),或使用 ``scripts/Lindent``
> > +這樣就可以以最時髦的方式縮排原始程式碼。
> >
> > -``indent`` 有很多選項,特別是重新格式化註釋的時候,你可能需要看一下它的手冊。
> > -不過記住: ``indent`` 不能修正壞的編程習慣。
> > +``indent`` 有很多選項,特別是重新格式化註解的時候,你可能需要看一下它的手冊。
> > +不過記住: ``indent`` 不能修正壞的程式設計習慣。
> >
> > 請注意,您還可以使用 ``clang-format`` 工具幫助您處理這些規則,快速自動重新格
> > -式化部分代碼,並審閱整個文件以發現代碼風格錯誤、打字錯誤和可能的改進。它還可
> > -以方便地排序 ``#include`` ,對齊變量/宏,重排文本和其他類似任務。
> > +式化部分程式碼,並審閱整個檔案以發現程式碼風格錯誤、打字錯誤和可能的改進。它還可
> > +以方便地排序 ``#include`` ,對齊變數/巨集,重排文字和其他類似任務。
> > 詳見 Documentation/dev-tools/clang-format.rst 。
>
> [...]
>
> > -分配一個數組的首選形式是這樣的:
> > +分配一個陣列的首選形式是這樣的:
> >
> > .. code-block:: c
> >
> > - p = kmalloc_array(n, sizeof(...), ...);
> > + p = kmalloc_objs(*p, n, ...);
> >
> > -分配一個零長數組的首選形式是這樣的:
> > +分配一個零長陣列的首選形式是這樣的:
> >
> > .. code-block:: c
> >
> > - p = kcalloc(n, sizeof(...), ...);
> > + p = kzalloc_objs(*p, n, ...);
> > +
> > +這兩種形式都會檢查分配大小 n * sizeof(...) 是否溢位,如果發生溢位則回傳
> > +NULL。
>
> I would say splitting this part into a small patch is better. But for this
> time, it's fine.