Summary: | ASTERISK-10407: [JANITOR] Change simple snprintf to ast_copy_string | ||
Reporter: | Tilghman Lesher (tilghman) | Labels: | |
Date Opened: | 2007-09-28 09:13:23 | Date Closed: | 2007-10-01 10:15:26 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) 2007092900_10843.diff | |
Description: | There are a good number of places in the code that we needlessly call snprintf(), when a plain string copy (ast_copy_string) will do. Note that a simple rearrangement of the arguments is necessary, from: snprintf(A, B, C); to ast_copy_string(A, C, B); You can find most of the cases in the code with the following shell command: find . -name \*.c -exec grep -EHn 'snprintf\([^,]*,[^,]*,[^,]*\);' {} \; | ||
Comments: | By: Michiel van Baak (mvanbaak) 2007-09-29 08:07:41 All the lines found with that find line are done in the uploaded patch. There are 5 left because ast_copy_string does not return anything By: Digium Subversion (svnbot) 2007-10-01 10:04:10 Repository: asterisk Revision: 84173 U trunk/apps/app_meetme.c U trunk/apps/app_minivm.c U trunk/channels/chan_iax2.c U trunk/channels/chan_mgcp.c U trunk/channels/chan_misdn.c U trunk/channels/chan_sip.c U trunk/channels/chan_skinny.c U trunk/channels/iax2-parser.c U trunk/main/asterisk.c U trunk/main/frame.c U trunk/main/rtp.c U trunk/main/say.c U trunk/pbx/dundi-parser.c U trunk/res/res_config_odbc.c ------------------------------------------------------------------------ r84173 | russell | 2007-10-01 10:04:09 -0500 (Mon, 01 Oct 2007) | 8 lines Corydon posted this janitor project to the bug tracker and mvanbaak provided a patch for it. It replaces a bunch of simple calls to snprintf with ast_copy_string (closes issue ASTERISK-10407) Reported by: Corydon76 Patches: 2007092900_10843.diff uploaded by mvanbaak (license 7) ------------------------------------------------------------------------ By: Digium Subversion (svnbot) 2007-10-01 10:15:26 Repository: asterisk Revision: 84174 U trunk/main/say.c ------------------------------------------------------------------------ r84174 | russell | 2007-10-01 10:15:25 -0500 (Mon, 01 Oct 2007) | 4 lines Change simple uses of snprintf to ast_copy_string. This was provided by mvanbaak as a part of issue ASTERISK-10407, but this part didn't apply because of a patch I applied right beforehand. ------------------------------------------------------------------------ |