if (retval == ERROR_SUCCESS){
retval = RegQueryValueEx(handle, lpszValueName, 0, &type, NULL, lpDataLen);
if (retval == ERROR_SUCCESS && type == REG_SZ) {
- if (*ptr != NULL) {
+ if (*ptr) {
Renew(*ptr, *lpDataLen, char);
}
else {
retval = RegQueryValueEx(handle, lpszValueName, 0, NULL, (PBYTE)*ptr, lpDataLen);
if (retval != ERROR_SUCCESS) {
Safefree(*ptr);
- *ptr = NULL;
+ *ptr = Nullch;
}
}
RegCloseKey(handle);
GetRegStr(const char *lpszValueName, char** ptr, DWORD* lpDataLen)
{
*ptr = GetRegStrFromKey(HKEY_CURRENT_USER, lpszValueName, ptr, lpDataLen);
- if (*ptr == NULL)
+ if (*ptr == Nullch)
{
*ptr = GetRegStrFromKey(HKEY_LOCAL_MACHINE, lpszValueName, ptr, lpDataLen);
}
/* $stdlib = $HKCU{"lib-$]"} || $HKLM{"lib-$]"} || $HKCU{"lib"} || $HKLM{"lib"} || ""; */
sprintf(buffer, "%s-%s", stdlib, pl);
path = GetRegStr(buffer, &path, &datalen);
- if (path == NULL)
+ if (!path)
path = GetRegStr(stdlib, &path, &datalen);
/* $stdlib .= ";$EMD/../../lib" */
DllExport char *
win32_getenv(const char *name)
{
- static char *curitem = Nullch;
- static DWORD curlen = 512;
+ static char *curitem = Nullch; /* XXX threadead */
+ static DWORD curlen = 512; /* XXX threadead */
DWORD needlen;
if (!curitem)
New(1305,curitem,curlen,char);
needlen = GetEnvironmentVariable(name,curitem,curlen);
}
}
- else
- {
+ else {
/* allow any environment variables that begin with 'PERL'
- to be stored in the registry
- */
- if(curitem != NULL)
+ to be stored in the registry */
+ if (curitem)
*curitem = '\0';
if (strncmp(name, "PERL", 4) == 0) {
- if (curitem != NULL) {
+ if (curitem) {
Safefree(curitem);
- curitem = NULL;
+ curitem = Nullch;
}
curitem = GetRegStr(name, &curitem, &curlen);
}
}
- if(curitem != NULL && *curitem == '\0')
+ if (curitem && *curitem == '\0')
return Nullch;
return curitem;