[hackers] [lchat] Avoid useless use of strdup(3). || Jan Klemkow

From: <git_AT_suckless.org>
Date: Sun, 14 Jul 2024 13:36:25 +0200 (CEST)

commit a6a8d970dae07920c68bbb4ca3d8020fa8555b46
Author: Jan Klemkow <j.klemkow_AT_wemelug.de>
AuthorDate: Sun Jul 14 13:34:16 2024 +0200
Commit: Jan Klemkow <j.klemkow_AT_wemelug.de>
CommitDate: Sun Jul 14 13:34:16 2024 +0200

    Avoid useless use of strdup(3).

diff --git a/lchat.c b/lchat.c
index 0df653d..6c57ec4 100644
--- a/lchat.c
+++ b/lchat.c
_AT_@ -196,24 +196,20 @@ main(int argc, char *argv[])
                                 die("strtoull:");
                         break;
                 case 'i':
- if ((in_file = strdup(optarg)) == NULL)
- die("strdup:");
+ in_file = optarg;
                         break;
                 case 'e':
                         empty_line = true;
                         break;
                 case 'o':
- if ((out_file = strdup(optarg)) == NULL)
- die("strdup:");
+ out_file = optarg;
                         break;
                 case 'p':
- if ((prompt = strdup(optarg)) == NULL)
- die("strdup:");
+ prompt = optarg;
                         prompt_len = strlen(prompt);
                         break;
                 case 't':
- if ((title = strdup(optarg)) == NULL)
- die("strdup:");
+ title = optarg;
                         break;
                 case 'u':
                         ucspi = true;
Received on Sun Jul 14 2024 - 13:36:25 CEST

This archive was generated by hypermail 2.3.0 : Sun Jul 14 2024 - 13:36:39 CEST