Mark Stapp
028872bf40
lib: fix -Wshadow warnings in the lib modules
...
Fix various "shadow" warnings in lib.
Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:26 -04:00
Christian Hopps
d58a8f473b
lib: add darr_strlen_fixup()
to update len based on NUL term
...
Signed-off-by: Christian Hopps <chopps@labn.net>
2025-03-14 08:37:46 +00:00
Christian Hopps
c88b48929c
lib: fix new (incorrect) CLANG SA warnings
...
Signed-off-by: Christian Hopps <chopps@labn.net>
2025-01-13 23:40:52 -05:00
Christian Hopps
fb85d18f59
lib: darr: fix bug with nested macro use
...
- WHen declaring macro scoped variables, can run into problem if the macro
variable passed in has the same name as the new variable introduced in the inner
scope. We don't get a warning and the uses will be wrong.
e.g.,
```
{
int __len = 10;
foo(__len); // => 10 and not 15 as we wanted.
}
```
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-12-15 22:01:56 -05:00
Christian Hopps
e14781eb1d
lib: darr: add free with element cleanup functions
...
- `darr_free_free` to `darr_free` each element prior to `darr_free`
the array.
- `darr_free_func` to call `func` on each element prior to `darr_free`
the array.
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-06 22:38:48 -04:00
Christian Hopps
29f2a300a3
lib: fix coverity issues
...
** CID 1575504: Insecure data handling (TAINTED_SCALAR) (maybe)
** CID 1575505: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
** CID 1575506: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
** CID 1575507: Null pointer dereferences (REVERSE_INULL)
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-11 18:14:58 +00:00
Christian Hopps
00138ffb47
lib: fix clang SA warnings
...
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-07 15:04:18 +00:00
Christian Hopps
b7db6b2675
lib: darr: add ability to set MTYPE for dynamic arrays
...
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-28 17:52:57 +00:00
Christian Hopps
f3d6edc7ee
lib: darr: add new access and str functions
...
- darr_last(), and darr_strdup_cap().
- strcat, strdup, strlen, strnul equivs.
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-28 17:52:57 +00:00
Christian Hopps
a6c8e08ecd
lib: darr needs to use memory.h for both alloc and free
...
Was using XREALLOC() and then free(). instant "memleaks".
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-11-11 20:30:02 +01:00
Christian Hopps
e6e0c5bd25
lib: add dynamic array type
...
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-27 18:00:56 -04:00