This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dogbert2
Recipients dogbert2, steve.dower, tim.golden, zach.ware
Date 2015-05-20.21:23:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1432156989.27.0.220297051277.issue24250@psf.upfronthosting.co.za>
In-reply-to
Content
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...
History
Date User Action Args
2015-05-20 21:23:09dogbert2setrecipients: + dogbert2, tim.golden, zach.ware, steve.dower
2015-05-20 21:23:09dogbert2setmessageid: <1432156989.27.0.220297051277.issue24250@psf.upfronthosting.co.za>
2015-05-20 21:23:09dogbert2linkissue24250 messages
2015-05-20 21:23:09dogbert2create