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 <rep...@bugs.python.org> <http://bugs.python.org/issue24250> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com