[New-bugs-announce] [issue24250] Optimization for strcpy(..., "") in file 'install.c'
Bill Parker
report at bugs.python.org
Wed May 20 23:23:09 CEST 2015
New submission from Bill Parker:
In reviewing calls to strcpy(<string>, ""), I found three instances which could be re-written as *<string> = '\0'; which would save the minor overhead of a function call. The patch file is below:
--- install.c.orig 2015-05-20 14:11:27.723397005 -0700
+++ install.c 2015-05-20 14:14:00.862860244 -0700
@@ -1640,8 +1640,8 @@
PSWIZB_BACK);
SetDlgItemText(hwnd, IDC_PATH, "");
SetDlgItemText(hwnd, IDC_INSTALL_PATH, "");
- strcpy(python_dir, "");
- strcpy(pythondll, "");
+ *python_dir = '\0'; /* replaces strcpy(python_dir, "") */
+ *pythondll = '\0'; /* replaces strcpy(pythondll, "") */
} else {
char *pbuf;
int result;
@@ -1680,7 +1680,7 @@
}
free(pbuf);
} else
- strcpy(pythondll, "");
+ *pythondll = '\0'; /* replaces strcpy(pythondll, "") */
/* retrieve the scheme for this version */
{
char install_path[_MAX_PATH];
I am attaching the patch file to this bug report...
----------
components: Windows
files: install.c.patch
keywords: patch
messages: 243697
nosy: dogbert2, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Optimization for strcpy(..., "") in file 'install.c'
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file39440/install.c.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24250>
_______________________________________
More information about the New-bugs-announce
mailing list