[Asterisk-cvs] asterisk cdr.c,1.44,1.45

kpfleming at lists.digium.com kpfleming at lists.digium.com
Fri Jun 17 08:49:48 CDT 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv30981

Modified Files:
	cdr.c 
Log Message:
minor fixes to conform to the newly-posted coding guideline :-)


Index: cdr.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cdr.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- cdr.c	17 Jun 2005 00:37:43 -0000	1.44
+++ cdr.c	17 Jun 2005 12:51:03 -0000	1.45
@@ -147,19 +147,20 @@
 	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 @@
 		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);




More information about the svn-commits mailing list