Skip to content
Snippets Groups Projects
  • Simon Tatham's avatar
    575ee4f8
    Make cmdline_tooltype a const int. · 575ee4f8
    Simon Tatham authored
    Another ugly mutable global variable gone: now, instead of this
    variable being defined in cmdline.c and written to by everyone's
    main(), it's defined _alongside_ everyone's main() as a constant, and
    cmdline.c just refers to it.
    
    A bonus is that now nocmdline.c doesn't have to define it anyway for
    tools that don't use cmdline.c. But mostly, it didn't need to be
    mutable, so better for it not to be.
    
    While I'm at it, I've also fiddled with the bit flags that go in it,
    to define their values automatically using a list macro instead of
    manually specifying each one to be a different power of 2.
    575ee4f8
    History
    Make cmdline_tooltype a const int.
    Simon Tatham authored
    Another ugly mutable global variable gone: now, instead of this
    variable being defined in cmdline.c and written to by everyone's
    main(), it's defined _alongside_ everyone's main() as a constant, and
    cmdline.c just refers to it.
    
    A bonus is that now nocmdline.c doesn't have to define it anyway for
    tools that don't use cmdline.c. But mostly, it didn't need to be
    mutable, so better for it not to be.
    
    While I'm at it, I've also fiddled with the bit flags that go in it,
    to define their values automatically using a list macro instead of
    manually specifying each one to be a different power of 2.
nocmdline.c 1.25 KiB