[Python-checkins] r42476 - python/trunk/PC/_winreg.c

georg.brandl python-checkins at python.org
Sun Feb 19 00:44:24 CET 2006


Author: georg.brandl
Date: Sun Feb 19 00:44:24 2006
New Revision: 42476

Modified:
   python/trunk/PC/_winreg.c
Log:
Add sizeof() instead of hardcoding variable length



Modified: python/trunk/PC/_winreg.c
==============================================================================
--- python/trunk/PC/_winreg.c	(original)
+++ python/trunk/PC/_winreg.c	Sun Feb 19 00:44:24 2006
@@ -1033,8 +1033,8 @@
 	long rc;
 	PyObject *retStr;
 	char *retBuf;
-	DWORD len = 256;  /* includes NULL terminator */
 	char tmpbuf[256]; /* max key name length is 255 */
+	DWORD len = sizeof(tmpbuf); /* includes NULL terminator */
 
 	if (!PyArg_ParseTuple(args, "Oi:EnumKey", &obKey, &index))
 		return NULL;


More information about the Python-checkins mailing list