XP_MEMCPY ((*out)->basicSearchAttributes, in->basicSearchAttributes, bsaLength);
memcpy((*out)->basicSearchAttributes, in->basicSearchAttributes, bsaLength);
nsresult DIR_CopyServer (DIR_Server *in, DIR_Server **out){	nsresult err = NS_OK;	if (in) {		*out = (DIR_Server*)PR_Malloc(sizeof(DIR_Server));		if (*out)		{			XP_BZERO (*out, sizeof(DIR_Server));			if (in->prefName)			{                (*out)->prefName = nsCRT::strdup(in->prefName);				if (!(*out)->prefName)					err = NS_ERROR_OUT_OF_MEMORY;			}			if (in->description)			{                (*out)->description = nsCRT::strdup(in->description);				if (!(*out)->description)					err = NS_ERROR_OUT_OF_MEMORY;			}			if (in->serverName)			{                (*out)->serverName = nsCRT::strdup(in->serverName);				if (!(*out)->serverName)					err = NS_ERROR_OUT_OF_MEMORY;			}			if (in->searchBase)			{                (*out)->searchBase = nsCRT::strdup(in->searchBase);				if (!(*out)->searchBase)					err = NS_ERROR_OUT_OF_MEMORY;			}			if (in->fileName)			{                (*out)->fileName = nsCRT::strdup(in->fileName);				if (!(*out)->fileName)					err = NS_ERROR_OUT_OF_MEMORY; 			}			if (in->columnAttributes)			{                (*out)->columnAttributes = nsCRT::strdup(in->columnAttributes);				if (!(*out)->columnAttributes)					err = NS_ERROR_OUT_OF_MEMORY;			}			if (in->locale)			{                (*out)->locale = nsCRT::strdup(in->locale);				if (!(*out)->locale)					err = NS_ERROR_OUT_OF_MEMORY;			}			(*out)->position = in->position;			(*out)->port = in->port;			(*out)->maxHits = in->maxHits;			(*out)->isSecure = in->isSecure;			(*out)->saveResults = in->saveResults;			(*out)->isOffline = in->isOffline;			(*out)->efficientWildcards = in->efficientWildcards;			(*out)->dirType = in->dirType;			(*out)->csid = in->csid;			(*out)->flags = in->flags;						(*out)->enableAuth = in->enableAuth;			(*out)->savePassword = in->savePassword;			if (in->authDn)			{                (*out)->authDn = nsCRT::strdup (in->authDn);				if (!(*out)->authDn)					err = NS_ERROR_OUT_OF_MEMORY;			}			if (in->password)			{                (*out)->password = nsCRT::strdup (in->password);				if (!(*out)->password)					err = NS_ERROR_OUT_OF_MEMORY;			}			if (in->customAttributes)			{				(*out)->customAttributes = new nsVoidArray();				if ((*out)->customAttributes)				{					nsVoidArray *list = in->customAttributes;					DIR_Attribute *attribute = nsnull;					PRInt32 count = list->Count();					PRInt32 i;					for (i = 0; i < count; i++)					{						attribute = (DIR_Attribute *)list->ElementAt(i);						if (attribute)						{							DIR_Attribute *outAttr = DIR_CopyAttribute (attribute);							if (outAttr)								((*out)->customAttributes)->AppendElement(outAttr);							else								err = NS_ERROR_OUT_OF_MEMORY; 						}					}				}				else					err = NS_ERROR_OUT_OF_MEMORY;			}			if (in->customFilters)			{				(*out)->customFilters = new nsVoidArray();				if ((*out)->customFilters)				{					nsVoidArray *list = in->customFilters;					DIR_Filter *filter = nsnull;					PRInt32 count = list->Count();					PRInt32 i;					for (i = 0; i < count; i++)					{						filter = (DIR_Filter *)list->ElementAt(i);						if (filter)						{							DIR_Filter *outFilter = DIR_CopyFilter (filter);							if (outFilter)								((*out)->customFilters)->AppendElement(outFilter);							else								err = NS_ERROR_OUT_OF_MEMORY;						}					}				}				else					err = NS_ERROR_OUT_OF_MEMORY;			}			if (in->autoCompleteFilter)			{                (*out)->autoCompleteFilter = nsCRT::strdup(in->autoCompleteFilter);				if (!(*out)->autoCompleteFilter)					err = NS_ERROR_OUT_OF_MEMORY;			}			if (in->replInfo)				(*out)->replInfo = dir_CopyReplicationInfo (in->replInfo);			if (in->basicSearchAttributesCount > 0)			{				PRInt32 bsaLength = in->basicSearchAttributesCount * sizeof(DIR_AttributeId);				(*out)->basicSearchAttributes = (DIR_AttributeId*) PR_Malloc(bsaLength);				if ((*out)->basicSearchAttributes)				{					XP_MEMCPY ((*out)->basicSearchAttributes, in->basicSearchAttributes, bsaLength);					(*out)->basicSearchAttributesCount = in->basicSearchAttributesCount;				}			}			dir_CopyTokenList (in->dnAttributes, in->dnAttributesCount,				&(*out)->dnAttributes, &(*out)->dnAttributesCount);			dir_CopyTokenList (in->suppressedAttributes, in->suppressedAttributesCount,				&(*out)->suppressedAttributes, &(*out)->suppressedAttributesCount);			dir_CopyTokenList (in->uriAttributes, in->uriAttributesCount,				&(*out)->uriAttributes, &(*out)->uriAttributesCount);			if (in->customDisplayUrl)                (*out)->customDisplayUrl = nsCRT::strdup (in->customDisplayUrl);			if (in->searchPairList)                (*out)->searchPairList = nsCRT::strdup (in->searchPairList);			(*out)->refCount = 1;		}		else {			err = NS_ERROR_OUT_OF_MEMORY;			(*out) = nsnull;		}	}	else {		PR_ASSERT (0);		err = NS_ERROR_FAILURE;		(*out) = nsnull;	}	return err;}