XUtils string related updates

- allow count out-parameter of String_split() to be NULL
- introduce xStrndup()
- do not allow NULL pointers passed to String_eq()
  it is not used in any code
- implement String_startsWith(), String_contains_i() and String_eq()
  as inline header functions
- adjust several conversion issues
This commit is contained in:
Christian Göttsche
2020-10-03 21:20:43 +02:00
parent 577416d1a9
commit 4c66eb6d4c
13 changed files with 77 additions and 65 deletions

2
htop.c
View File

@ -122,7 +122,7 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
exit(0);
case 's':
assert(optarg); /* please clang analyzer, cause optarg can be NULL in the 'u' case */
if (strcmp(optarg, "help") == 0) {
if (String_eq(optarg, "help")) {
for (int j = 1; j < Platform_numberOfFields; j++) {
const char* name = Process_fields[j].name;
if (name) printf ("%s\n", name);