rem: defaults = wmalloc(sizeof(WMUserDefaults)); memset(defaults, 0, sizeof(WMUserDefaults));  defaults->defaults = PLMakeDictionaryFromEntries(NULL, NULL, NULL);  defaults->searchList = wmalloc(sizeof(proplist_t)*3);   key = PLMakeString(WMGetApplicationName()); defaults->searchList[0] = key;   if (strcmp(WMGetApplicationName(), "WindowMaker")==0) { domain = NULL; path = NULL; } else { path = wdefaultspathfordomain(PLGetString(key));  domain = PLGetProplistWithPath(path); } if (!domain) { proplist_t p;  domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL); if (path) { p = PLMakeString(path); PLSetFilename(domain, p); PLRelease(p); } } if (path) free(path);  defaults->appDomain = domain;  if (domain) PLInsertDictionaryEntry(defaults->defaults, key, domain);  PLRelease(key);   key = PLMakeString("WMGLOBAL"); defaults->searchList[1] = key;  path = wdefaultspathfordomain(PLGetString(key));  domain = PLGetProplistWithPath(path);  free(path);  if (!domain) domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);  if (domain) PLInsertDictionaryEntry(defaults->defaults, key, domain);  PLRelease(key);   defaults->searchList[2] = NULL;  defaults->searchListArray=PLMakeArrayFromElements(NULL,NULL);   i = 0; while (defaults->searchList[i]) { PLAppendArrayElement(defaults->searchListArray, defaults->searchList[i]); i++; }  sharedUserDefaults = defaults;  registerSaveOnExit();
add: if (sharedUserDefaults) { defaults = sharedUserDefaults; while (defaults) {  if (defaults->path == NULL) return defaults; defaults = defaults->next; }
context: WMGetStandardUserDefaults(void){        if (!sharedUserDefaults) {	WMUserDefaults *defaults;		proplist_t domain;	proplist_t key;	char *path;	int i;	defaults = wmalloc(sizeof(WMUserDefaults));	memset(defaults, 0, sizeof(WMUserDefaults));	defaults->defaults = PLMakeDictionaryFromEntries(NULL, NULL, NULL);	defaults->searchList = wmalloc(sizeof(proplist_t)*3);		/* application domain */	key = PLMakeString(WMGetApplicationName());	defaults->searchList[0] = key;	/* temporary kluge */	if (strcmp(WMGetApplicationName(), "WindowMaker")==0) {	    domain = NULL; 	    path = NULL;	} else {	    path = wdefaultspathfordomain(PLGetString(key));		    domain = PLGetProplistWithPath(path);	}	if (!domain) {	    proplist_t p;	    domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);	    if (path) {		p = PLMakeString(path);		PLSetFilename(domain, p);		PLRelease(p);	    }	}	if (path)	    free(path);	defaults->appDomain = domain;	if (domain)	    PLInsertDictionaryEntry(defaults->defaults, key, domain);	PLRelease(key);	/* global domain */	key = PLMakeString("WMGLOBAL");	defaults->searchList[1] = key;	path = wdefaultspathfordomain(PLGetString(key));	domain = PLGetProplistWithPath(path);    	free(path);	if (!domain)	    domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);	if (domain)	    PLInsertDictionaryEntry(defaults->defaults, key, domain);	PLRelease(key);		/* terminate list */	defaults->searchList[2] = NULL;	defaults->searchListArray=PLMakeArrayFromElements(NULL,NULL);		i = 0;	while (defaults->searchList[i]) {	    PLAppendArrayElement(defaults->searchListArray, 				 defaults->searchList[i]);	    i++;	}	sharedUserDefaults = defaults;	        registerSaveOnExit();    }    return sharedUserDefaults;}