rem: DBG("XJAB:xj_wlist_set_aliases\n");
context: int  xj_wlist_set_aliases(xj_wlist jwl, char *als, char *jd){	char *p, *p0, *p1;	int i, n;		DBG("XJAB:xj_wlist_set_aliases\n");	if(jwl == NULL)		return -1;	if(!jd) // || !als || strlen(als)<2)		return 0;		if((jwl->aliases = (xj_jalias)_M_SHM_MALLOC(sizeof(t_xj_jalias)))==NULL)	{		DBG("XJAB:xj_wlist_set_aliases: not enough SHMemory.\n");		return -1;	}		jwl->aliases->jdm = NULL;	jwl->aliases->dlm = XJ_DEF_JDELIM; // default user part delimitator	jwl->aliases->size = 0;	jwl->aliases->a = NULL;	jwl->aliases->d = NULL;	if(jd != NULL && (n=strlen(jd))>2)	{		p = jd;		while(p < jd+n && *p!='=')			p++;		if(p<jd+n-1)		{			jwl->aliases->dlm = *(p+1);			n = p - jd;		}		if((jwl->aliases->jdm = (str*)_M_SHM_MALLOC(sizeof(str)))== NULL)		{			DBG("XJAB:xj_wlist_set_aliases: not enough SHMemory!?\n");			_M_SHM_FREE(jwl->aliases);			jwl->aliases = NULL;			return -1;				}		jwl->aliases->jdm->len = n;		if((jwl->aliases->jdm->s=(char*)_M_SHM_MALLOC(jwl->aliases->jdm->len))				== NULL)		{			DBG("XJAB:xj_wlist_set_aliases: not enough SHMemory!?!\n");			_M_SHM_FREE(jwl->aliases->jdm);			_M_SHM_FREE(jwl->aliases);			jwl->aliases = NULL;		}		strncpy(jwl->aliases->jdm->s, jd, jwl->aliases->jdm->len);		DBG("XJAB:xj_wlist_set_aliases: jdomain=%.*s delim=%c\n",			jwl->aliases->jdm->len, jwl->aliases->jdm->s, jwl->aliases->dlm);	}		if(!als || strlen(als)<2)		return 0;		if((p = strchr(als, ';')) == NULL)	{		DBG("XJAB:xj_wlist_set_aliases: bad parameter value\n");		return -1;	}		if((jwl->aliases->size = atoi(als)) <= 0)	{		DBG("XJAB:xj_wlist_set_aliases: wrong number of aliases\n");		return 0;	}		jwl->aliases->d = (char*)_M_SHM_MALLOC(jwl->aliases->size*sizeof(char));	if(jwl->aliases->d == NULL)	{		DBG("XJAB:xj_wlist_set_aliases: not enough SHMemory..\n");		goto clean2;	}	memset(jwl->aliases->d, 0, jwl->aliases->size);		jwl->aliases->a = (str*)_M_SHM_MALLOC(jwl->aliases->size*sizeof(str));	if(jwl->aliases->a == NULL)	{		DBG("XJAB:xj_wlist_set_aliases: not enough SHMemory..\n");		goto clean1;	}		p++;	for(i=0; i<jwl->aliases->size; i++)	{		if((p0 = strchr(p, ';'))==NULL)		{			DBG("XJAB:xj_wlist_set_aliases: bad parameter value format\n");			goto clean;		}		n = p0 - p;		p1 = strchr(p, '=');		if(p1 && p1<p0-1)		{			jwl->aliases->d[i] = *(p1+1);			n = p1 - p;		}		jwl->aliases->a[i].len = n;		if((jwl->aliases->a[i].s = (char*)_M_SHM_MALLOC(jwl->aliases->a[i].len))				== NULL)		{			DBG("XJAB:xj_wlist_set_aliases: not enough SHMemory!\n");			goto clean;		}					strncpy(jwl->aliases->a[i].s, p, jwl->aliases->a[i].len);		DBG("XJAB:xj_wlist_set_aliases: alias[%d/%d]=%.*s delim=%c\n", 			i+1, jwl->aliases->size, jwl->aliases->a[i].len, 			jwl->aliases->a[i].s, jwl->aliases->d[i]?jwl->aliases->d[i]:'X');		p = p0 + 1;	}	return 0;clean:	while(i>0)	{		_M_SHM_FREE(jwl->aliases->a[i-1].s);		i--;	}	_M_SHM_FREE(jwl->aliases->a);clean1:	if(jwl->aliases->d)		_M_SHM_FREE(jwl->aliases->d);clean2:	if(jwl->aliases->jdm)	{		_M_SHM_FREE(jwl->aliases->jdm->s);		_M_SHM_FREE(jwl->aliases->jdm);	}	_M_SHM_FREE(jwl->aliases);	jwl->aliases = NULL;	return -1;}