diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-20 22:35:44 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-20 22:35:44 +0100 |
commit | 8d2185ffe5faf19a82ba62322d02c635c82f8032 (patch) | |
tree | 5b12233ee81d1f4939f31960e5709d580ea2746b /FICS/multicol.c | |
parent | 557371f7b2f2a4e58c20e994124f77b7ed6f01da (diff) |
Reformatted multicol_store() and added null checks
Diffstat (limited to 'FICS/multicol.c')
-rw-r--r-- | FICS/multicol.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/FICS/multicol.c b/FICS/multicol.c index 4853b3f..416c1a5 100644 --- a/FICS/multicol.c +++ b/FICS/multicol.c @@ -43,15 +43,14 @@ PUBLIC multicol *multicol_start(int maxArray) return m; } -PUBLIC int multicol_store(multicol * m, char *str) +PUBLIC int +multicol_store(multicol *m, char *str) { - if (m->num >= m->arraySize) - return -1; - if (!str) - return -1; - m->strArray[m->num] = xstrdup(str); - m->num++; - return 0; + if (m == NULL || str == NULL || m->num >= m->arraySize) + return -1; + m->strArray[m->num] = xstrdup(str); + m->num++; + return 0; } PUBLIC int |