ngircd

Free, portable and lightweight Internet Relay Chat server http://ngircd.barton.de/
Log | Files | Refs | README | LICENSE

commit 51396f8f1c10506b558ce98aafb80aff4b2a95bd
parent 6238196dac6cab9dae0b4d01190a7fad307d5a93
Author: Alexander Barton <alex@barton.de>
Date:   Sun, 16 Mar 2014 22:59:03 +0100

strdup.c: Code cleanup

Diffstat:
Msrc/portab/strdup.c | 19++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/portab/strdup.c b/src/portab/strdup.c @@ -19,18 +19,19 @@ #include "exp.h" GLOBAL char * -strdup( const char *s ) +strdup(const char *s) { - char *dup; - size_t len = strlen( s ); - size_t alloc = len + 1; + char *dup; + size_t len = strlen(s); + size_t alloc = len + 1; - if (len >= alloc ) return NULL; - dup = malloc( alloc ); - if (dup) strlcpy(dup, s, alloc ); + if (len >= alloc) + return NULL; + dup = malloc(alloc); + if (dup) + strlcpy(dup, s, alloc ); -return dup; + return dup; } #endif -