From 63d1172508ff4ad0f5bf88b5f9f94d083a36664d Mon Sep 17 00:00:00 2001 From: Karl Ramm Date: Sun, 22 Aug 2010 00:56:16 +0000 Subject: fix an allocation-size braino and rearrange for readability --- lib/Zinternal.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'lib/Zinternal.c') diff --git a/lib/Zinternal.c b/lib/Zinternal.c index 7c9bb4a..189fa6e 100644 --- a/lib/Zinternal.c +++ b/lib/Zinternal.c @@ -581,15 +581,14 @@ Z_AddNoticeToEntry(struct _Z_InputQ *qptr, hole = hole->next; } if (lasthole) { - if (!(lasthole->next = (struct _Z_Hole *) - malloc(sizeof(struct _Z_InputQ)))) - return (ENOMEM); + lasthole->next = (struct _Z_Hole *)malloc(sizeof(struct _Z_Hole)); + if (lasthole->next == NULL) + return ENOMEM; hole = lasthole->next; - } - else { - if (!(qptr->holelist = (struct _Z_Hole *) - malloc(sizeof(struct _Z_InputQ)))) - return (ENOMEM); + } else { + qptr->holelist = (struct _Z_Hole *)malloc(sizeof(struct _Z_Hole)); + if (qptr->holelist == NULL) + return ENOMEM; hole = qptr->holelist; } hole->next = NULL; @@ -605,15 +604,14 @@ Z_AddNoticeToEntry(struct _Z_InputQ *qptr, hole = hole->next; } if (lasthole) { - if (!(lasthole->next = (struct _Z_Hole *) - malloc(sizeof(struct _Z_InputQ)))) - return (ENOMEM); + lasthole->next = (struct _Z_Hole *)malloc(sizeof(struct _Z_Hole)); + if (lasthole->next == NULL) + return ENOMEM; hole = lasthole->next; - } - else { - if (!(qptr->holelist = (struct _Z_Hole *) - malloc(sizeof(struct _Z_InputQ)))) - return (ENOMEM); + } else { + qptr->holelist = (struct _Z_Hole *)malloc(sizeof(struct _Z_Hole)); + if (qptr->holelist == NULL) + return ENOMEM; hole = qptr->holelist; } hole->next = (struct _Z_Hole *) 0; -- cgit v1.2.3