8000 Style fixes by tsutsui · Pull Request #81 · taka-tuos/nanotodon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Style fixes #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 7, 2024
Merged

Style fixes #81

merged 2 commits into from
Dec 7, 2024

Conversation

tsutsui
Copy link
Contributor
@tsutsui tsutsui commented Dec 6, 2024

最近静的解析ばかりやってるので目視で気づいたところだけなんとなく修正。
(何かをやった気になるためのコード盆栽ともいう)

  • *.c で宣言されている関数はローカル扱いで static 付与
  • ざっと見て変更されない引数は const 付与
  • 関数プロトタイプから変数名を削除
    (これはスタイル定義からですが、ありなし混在してたので)
  • プロトタイプについて char* varchar *var が混在してたところは後者に統一
    (これもスタイル定義からですが、後者が多数派っぽいので)

staticconst は inline とかの最適化で効果あるはず、というやつですが計測はしてません。

hidlckflagnoemojiflagmonoflag と同列で export じゃないの、という説もありますが
現状 nanotodon.h には無いのと、monoflag についてもグローバルにせず
sixel_init()sixel_out() (とそれを呼び出している print_picture()) の引数で
mono か否かを指定すればいいのでは、とか考え出すと止まらないので機械的に static にしています。

あと、 -Wall だと以下の警告も出ているようですが、意図が把握できていないのでここではいじっていません。

sixel.c: In function 'sixel_out':
sixel.c:323:11: warning: unused variable 'delta' [-Wunused-variable]
  323 |  uint32_t delta = mul & 0x100 ? 4 : 1;

@taka-tuos taka-tuos merged commit 846a9ad into taka-tuos:master Dec 7, 2024
12 checks passed
@tsutsui tsutsui deleted the make-local-vars-static branch December 7, 2024 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0