argpar.{c,h}: fix clang-tidy issues
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 15 Mar 2024 15:43:09 +0000 (11:43 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 18 Mar 2024 14:59:40 +0000 (10:59 -0400)
commit2f9b764965e29a0d0e26d95352b8f0a7bb705aed
treed001fe5e14c4e2c260a57b8de4f76e7fbeba6d45
parentf3f087bd6debb55492e35b1397c8658b8e1e77ae
argpar.{c,h}: fix clang-tidy issues

Fix these issues:

    /home/smarchi/src/argpar/argpar/argpar.h:344:9: warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses]
      344 |         _item = NULL;                                                                              \
          |         ^
          |         (    )
    argpar.c:525:34: warning: 'iter->tmp_buf.data' may be set to null if 'realloc' fails, which may result in a leak of the original buffer [bugprone-suspicious-realloc-usage]
      525 |             iter->tmp_buf.data = ARGPAR_REALLOC(iter->tmp_buf.data, char, iter->tmp_buf.size);
          |             ~~~~~~~~~~~~~~~~~~   ^
    argpar.c:15:56: note: expanded from macro 'ARGPAR_REALLOC'
       15 | #define ARGPAR_REALLOC(_ptr, _type, _nmemb) ((_type *) realloc(_ptr, (_nmemb) * sizeof(_type)))
          |                                                        ^       ~~~~

Change-Id: I2e42059f8c4c744e10bdbc7c78b2628a53cd60d7
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
argpar/argpar.c
argpar/argpar.h
This page took 0.022625 seconds and 4 git commands to generate.