[issue24250] Optimization for strcpy(..., "") in file 'install.c'

2015-05-21 Thread Benjamin Peterson

Benjamin Peterson added the comment:

I agree with vadmium and also note that many compilers (though I don't know 
about MSVC) can optimize the strcpy call away.

--
nosy: +benjamin.peterson
resolution:  -> works for me
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24250] Optimization for strcpy(..., "") in file 'install.c'

2015-05-21 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
priority: normal -> low
stage:  -> patch review
versions: +Python 3.5 -Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24250] Optimization for strcpy(..., "") in file 'install.c'

2015-05-21 Thread Martin Panter

Martin Panter added the comment:

For the record, the file being patched is PC/bdist_wininst/install.c

My opinion is the original is more readable, and unless this is some inner loop 
bottleneck here it seems like premature optimization.

--
nosy: +vadmium

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24250] Optimization for strcpy(..., "") in file 'install.c'

2015-05-21 Thread Paul Moore

Paul Moore added the comment:

The patch looks fine to me, although I don't think you need the comment showing 
the old code. The new code is perfectly clear on its own.

--
nosy: +paul.moore

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24250] Optimization for strcpy(..., "") in file 'install.c'

2015-05-20 Thread Bill Parker

New submission from Bill Parker:

In reviewing calls to strcpy(, ""), I found three instances which could 
be re-written as * = '\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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com