minor fixes to conform to the newly-posted coding guideline :-)
authorKevin P. Fleming <kpfleming@digium.com>
Fri, 17 Jun 2005 12:51:03 +0000 (12:51 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Fri, 17 Jun 2005 12:51:03 +0000 (12:51 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5921 65c4cc65-6c06-0410-ace0-fbb531ad65f3

cdr.c

diff --git a/cdr.c b/cdr.c
index bdac2fb..9a01ec0 100755 (executable)
--- a/cdr.c
+++ b/cdr.c
@@ -147,19 +147,20 @@ void ast_cdr_unregister(char *name)
        AST_LIST_UNLOCK(&be_list);
 }
 
-static struct ast_cdr *ast_cdr_dup(struct ast_cdr *cdr) 
+static struct ast_cdr *cdr_dup(struct ast_cdr *cdr) 
 {
-       struct ast_cdr *newcdr = NULL;
+       struct ast_cdr *newcdr;
 
        if (!(newcdr = ast_cdr_alloc())) {
                ast_log(LOG_ERROR, "Memory Error!\n");
-       } else {
-               memcpy(newcdr,cdr,sizeof(struct ast_cdr));
-               /* The varshead is unusable, volatile even, after the memcpy so we take care of that here */
-               memset(&newcdr->varshead, 0, sizeof(newcdr->varshead));
-               ast_cdr_copy_vars(newcdr, cdr);
+               return NULL;
        }
 
+       memcpy(newcdr, cdr, sizeof(*newcdr));
+       /* The varshead is unusable, volatile even, after the memcpy so we take care of that here */
+       memset(&newcdr->varshead, 0, sizeof(newcdr->varshead));
+       ast_cdr_copy_vars(newcdr, cdr);
+
        return newcdr;
 }
 
@@ -822,7 +823,7 @@ void ast_cdr_reset(struct ast_cdr *cdr, int flags)
                if (ast_test_flag(&tmp, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
                        if (ast_test_flag(&tmp, AST_CDR_FLAG_POSTED)) {
                                ast_cdr_end(cdr);
-                               if ((dup = ast_cdr_dup(cdr))) {
+                               if ((dup = cdr_dup(cdr))) {
                                        ast_cdr_detach(dup);
                                }
                                ast_set_flag(cdr, AST_CDR_FLAG_POSTED);