Skip to content
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

Improve make dist to warn on building inside a git repository #1458

Closed
wants to merge 28 commits into from

Commits on Apr 17, 2024

  1. Improve make dist to warn on building inside a git repository

    Daniel Lange authored and Daniel Lange committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    50ad97c View commit details
    Browse the repository at this point in the history

Commits on May 17, 2024

  1. Use 'fp' name for local 'FILE*' variables.

    It is inappropriate to use the 'fd' name for 'FILE*' variables.
    POSIX file descriptiors are of type 'int' and are distinguished from
    ISO C stream pointers (type 'FILE*').
    
    Rename these variables to 'fp', which is a preferred naming in POSIX.
    (Note that ISO C preferred the 'stream' name for the variables.)
    
    No code changes.
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    64a7a6a View commit details
    Browse the repository at this point in the history
  2. Use 'sb' name for local 'struct stat' buffers

    Deprecate the use of 'st' and other names. The 'sb' name is often seen
    in example codes in Linux man pages. (The 'statbuf' name is sometimes
    also used but I choose 'sb' name because it's shorter.)
    
    No code changes.
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    56c276f View commit details
    Browse the repository at this point in the history
  3. Explicit memory initialization when reading status file

    BenBE authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    ebefd73 View commit details
    Browse the repository at this point in the history
  4. Reserve full function array to make the GCC14 static code analyzer happy

    Only happens with LTO, -fanalyzer, and -fsanitize=address,leak
    BenBE authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    86f187e View commit details
    Browse the repository at this point in the history
  5. Avoid magic numbers for the size of FunctionBar lists

    BenBE authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    42b2012 View commit details
    Browse the repository at this point in the history
  6. Obsolete the CUSTOM_METERMODE use in default mode

    The use of CUSTOM_METERMODE value in meter default mode was a bad
    design. There are no meter that really has a "custom" mode to work with
    and currently that value serves as a useless placeholder that hides the
    real default mode for a meter.
    
    Replace CUSTOM_METERMODE in `defaultMode` of all meters with the real
    intended default modes. Currently only CPU meters and MemorySwapMeter
    used this, and their real defaults are BAR_METERMODE.
    
    In Meter_setMode(), remove the special treatment of `defaultMode ==
    CUSTOM_METERMODE`, Meter_setMode() still calls the `updateMode` function
    for custom treatment when it's present for a meter class.
    
    As CUSTOM_METERMODE is obsolete from `defaultMode`, the init functions
    of CPU meters and MemorySwapMeter need to be adjusted to avoid
    incomplete initialization (Meter.draw function bring NULL).
    
    Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    50365a0 View commit details
    Browse the repository at this point in the history
  7. Don't initialize meter mode in custom meter init functions

    Let the respective `MeterClass.updateMode` functions initialize the
    meter mode instead. The `updateMode` function is always called after the
    `MeterClass.init` function by `Meter_new()`.
    
    This not only simplifies the init functions of meter subclasses, but
    avoids the use of the global `Meter_modes` array when it's unnecessary.
    
    Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    1671879 View commit details
    Browse the repository at this point in the history
  8. Remove CUSTOM_METERMODE MeterModeId

    Meter mode ID 0 will now be reserved.
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    dda6ae8 View commit details
    Browse the repository at this point in the history
  9. CPUMeter: Read height from sub-meter objects

    The Meter objects have their own 'h' properties.
    Avoid access to the `Meter_modes` array.
    
    Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    9089607 View commit details
    Browse the repository at this point in the history
  10. MemorySwapMeter: Read height from sub-meter objects

    The Meter objects have their own 'h' properties.
    Avoid access to the `Meter_modes` array.
    
    Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    3d790e2 View commit details
    Browse the repository at this point in the history
  11. Reorder Meter.c sections. No code changes.

    This section reordering is a prerequisite to privatizing the
    `Meter_modes` array.
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    7289abf View commit details
    Browse the repository at this point in the history
  12. Make 'Meter_modes' private and simplify its structure

    All client codes that access this global `Meter_modes` array have been
    replaced in previous commits, thus it's no longer necessary to keep
    this internal information (draw functions, default heights, etc.)
    public. It was also a bad idea when the client codes need to avoid
    accessing `Meter_modes[0]` (which is reserved and contains null
    information) by themselves.
    
    Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    417f73c View commit details
    Browse the repository at this point in the history
  13. New header "MeterMode.h" for MeterModeId definitions

    This is a prerequisite to using MeterModeId type in more headers, to
    avoid header dependency hell.
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    9f5e4fe View commit details
    Browse the repository at this point in the history
  14. Define MeterModeId to unsigned int and use it throughout

    All uses of meter drawing "mode" numbers now have the type
    `MeterModeId`, including the uses in structures and arrays.
    `MeterModeId` is defined as `unsigned int`, as (currently) it doesn't
    save any code size by defining it to any smaller type.
    
    Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    9e28da5 View commit details
    Browse the repository at this point in the history
  15. MemorySwapMeter_init() code shrink

    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    7fd551b View commit details
    Browse the repository at this point in the history
  16. Adjust some code style for maintainability

    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    439d54d View commit details
    Browse the repository at this point in the history
  17. Use struct member to determine size of allocations

    BenBE authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    1ae2175 View commit details
    Browse the repository at this point in the history
  18. darwin: avoid double division by zero on startup

    cgzones authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    42a6667 View commit details
    Browse the repository at this point in the history
  19. darwin: scan thread information

    Inspired by: hishamhm/htop#848
    
    Closes: htop-dev#542
    robaho authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    de40e65 View commit details
    Browse the repository at this point in the history
  20. Update '__STDC_VERSION__' check with C23

    `__STDC_VERSION__` will be defined as 202311L for C23.
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    33094bb View commit details
    Browse the repository at this point in the history
  21. Fix "CPU usage bar" help alignment.

    antonsoroko authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    9659d60 View commit details
    Browse the repository at this point in the history
  22. Linux: Permit non-ASCII for CGROUP, CONTAINER & SECATTR fields

    Assume the CGROUP, CCGROUP, CONTAINER and SECATTR field value may
    contain non-ASCII characters and use RichString_appendWide() to convert
    the strings.
    
    Patch suggested by Christian Göttsche (@cgzones)
    
    Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    cdb7b0e View commit details
    Browse the repository at this point in the history
  23. Fix GCC build warning in NetBSD 10

    The warning message is
    "array subscript has type 'char' [-Wchar-subscripts]"
    
    Fix this by casting to 'unsigned char' before passing any character to a
    `<ctype.h>` function.
    
    Also add an assertion to RichString_writeFromAscii() to ensure the
    characters in the string are all in ASCII range.
    
    Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
    Explorer09 authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    8f7dbd4 View commit details
    Browse the repository at this point in the history
  24. CI: Bump NetBSD version to 10.0

    fraggerfox authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    b449b68 View commit details
    Browse the repository at this point in the history
  25. Linux: show newlines in commands as ? instead of space

    Since \n is used internally by htop to split command lines, replace \n
    with \r in command lines to not display them as space.
    
    Merging the command string will not work, but newlines in commands
    should be rather the exception.
    cgzones authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    8f88fdf View commit details
    Browse the repository at this point in the history
  26. Annotate mbstowcs_nonfatal() with restrict

    The arguments to our mbrtowc(3) wrapper should not alias, since they
    also must not for mbrtowc(3).
    
    Might help some compilers optimizing the code.
    cgzones authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    ce733a3 View commit details
    Browse the repository at this point in the history
  27. Linux: reorder /proc/<pid>/status parsing

    When parsing an essential pid entry file like 'status' fails, we treat
    the process as a short-lived one and skip adding it into the process
    table.
    
    This should be done before the process is added, as the goto label used
    for error handling can free the process structure, thus causing an
    use-after-free scenario.
    
    Fixes: 22d25db ("Linux: detect container process by different PID namespace")
    Closes: htop-dev#1455
    cgzones authored and Daniel Lange committed May 17, 2024
    Configuration menu
    Copy the full SHA
    f16719b View commit details
    Browse the repository at this point in the history