From 1bbb981f09fb0e935d429d94d68ab10522aca321 Mon Sep 17 00:00:00 2001 From: Andinus Date: Fri, 3 Sep 2021 10:56:33 +0530 Subject: C: Acronym: Single statement for initial check --- c/acronym/src/acronym.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'c/acronym') diff --git a/c/acronym/src/acronym.c b/c/acronym/src/acronym.c index 9d86a6d..6bc3b10 100644 --- a/c/acronym/src/acronym.c +++ b/c/acronym/src/acronym.c @@ -3,8 +3,7 @@ #include char *abbreviate(const char *phrase) { - if (phrase == NULL) return NULL; - if (phrase[0] == '\0') return NULL; + if (phrase == NULL || phrase[0] == '\0') return NULL; size_t pos = 0; char *acronym = malloc(1 * sizeof(char)); -- cgit 1.4.1-2-gfad0 );'> Soul of a tiny new machine. More thorough tests → More comprehensible and rewrite-friendly software → More resilient society.Kartik K. Agaram <vc@akkartik.com>
about summary refs log blame commit diff stats
blob: 89dfc8a5bb8f85158b8eab9513a50bd7e695f221 (plain) (tree)
1
2
3
4
5
6
7
8
9