mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	Some CDR code optimization.
........ Merged revisions 397892 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397893 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -204,7 +204,6 @@ AST_APP_OPTIONS(cdr_func_options, { | ||||
| static int cdr_read(struct ast_channel *chan, const char *cmd, char *parse, | ||||
| 		    char *buf, size_t len) | ||||
| { | ||||
| 	char format_buf[128]; | ||||
| 	char *value = NULL; | ||||
| 	struct ast_flags flags = { 0 }; | ||||
| 	char tempbuf[512]; | ||||
| @@ -252,7 +251,7 @@ static int cdr_read(struct ast_channel *chan, const char *cmd, char *parse, | ||||
| 			return 0; | ||||
| 		} | ||||
| 		dtime = (double)(ms / 1000.0); | ||||
| 		sprintf(tempbuf, "%lf", dtime); | ||||
| 		snprintf(tempbuf, sizeof(tempbuf), "%lf", dtime); | ||||
| 	} else if (!ast_test_flag(&flags, OPT_UNPARSED)) { | ||||
| 		if (!strcasecmp("start", args.variable) | ||||
| 			|| !strcasecmp("end", args.variable) | ||||
| @@ -278,8 +277,7 @@ static int cdr_read(struct ast_channel *chan, const char *cmd, char *parse, | ||||
| 					args.variable, tempbuf, ast_channel_name(chan)); | ||||
| 				return 0; | ||||
| 			} | ||||
| 			sprintf(format_buf, "%s", ast_cdr_disp2str(disposition)); | ||||
| 			strcpy(tempbuf, format_buf); | ||||
| 			snprintf(tempbuf, sizeof(tempbuf), "%s", ast_cdr_disp2str(disposition)); | ||||
| 		} else if (!strcasecmp("amaflags", args.variable)) { | ||||
| 			int amaflags; | ||||
|  | ||||
| @@ -288,8 +286,7 @@ static int cdr_read(struct ast_channel *chan, const char *cmd, char *parse, | ||||
| 					args.variable, tempbuf, ast_channel_name(chan)); | ||||
| 				return 0; | ||||
| 			} | ||||
| 			sprintf(format_buf, "%s", ast_channel_amaflags2string(amaflags)); | ||||
| 			strcpy(tempbuf, format_buf); | ||||
| 			snprintf(tempbuf, sizeof(tempbuf), "%s", ast_channel_amaflags2string(amaflags)); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user