From 73bec459fa5475788364f00ce2eb55e9ff4ed759 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Tue, 27 Aug 2013 09:25:57 +0200 Subject: [PATCH] inperrc.c: comments added, white spaces --- src/spicelib/parser/inperrc.c | 36 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/spicelib/parser/inperrc.c b/src/spicelib/parser/inperrc.c index 3dadd8ab0..31ae5c5a5 100644 --- a/src/spicelib/parser/inperrc.c +++ b/src/spicelib/parser/inperrc.c @@ -3,6 +3,10 @@ Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles **********/ /* + Concatenate two strings, which have to be defined on the heap. + If either is NULL, the other is returned. If both are defined, + a new string is malloced, they are combined, both input strings + are freed, and the new string is returned. */ #include "ngspice/ngspice.h" @@ -13,22 +17,20 @@ Author: 1985 Thomas L. Quarles char *INPerrCat(char *a, char *b) { - if (a != NULL) { - if (b == NULL) { /* a valid, b null, return a */ - return (a); - } else { /* both valid - hard work... */ - register char *errtmp; - errtmp = - TMALLOC(char, strlen(a) + strlen(b) + 2); - (void) strcpy(errtmp, a); - (void) strcat(errtmp, "\n"); - (void) strcat(errtmp, b); - FREE(a); - FREE(b); - return (errtmp); - } - } else { /* a null, so return b */ - return (b); - } + if (b == NULL) { /* a valid, b null, return a */ + return (a); + } else { /* both valid - hard work... */ + register char *errtmp; + errtmp = + TMALLOC(char, strlen(a) + strlen(b) + 2); + (void) strcpy(errtmp, a); + (void) strcat(errtmp, "\n"); + (void) strcat(errtmp, b); + FREE(a); + FREE(b); + return (errtmp); + } + } else /* a null, so return b */ + return (b); }