rem: rest=8-i-idx1; memcpy(addr_start+idx1+rest, addr_end, i*sizeof(unsigned short));
add: if (addr==addr_end){ rest=8-i-idx1; memcpy(addr_start+idx1+rest, addr_end, i*sizeof(unsigned short)); }
context: static inline struct ip_addr* str2ip6(unsigned char* str, unsigned int len){	int i, idx1, rest;	int no_colons;	int double_colon;	int hex;	static struct ip_addr ip;	unsigned short* addr_start;	unsigned short addr_end[8];	unsigned short* addr;	unsigned char* limit;	unsigned char* init;		/* init */	init=str;	i=idx1=rest=0;	double_colon=0;	no_colons=0;	ip.af=AF_INET6;	ip.len=16;	addr_start=ip.u.addr16;	addr=addr_start;	limit=str+len;	memset(addr_start, 0 , 8*sizeof(unsigned short));	memset(addr_end, 0 , 8*sizeof(unsigned short));		for (; str<limit; str++){		if (*str==':'){			no_colons++;			if (no_colons>7) goto error_too_many_colons;			if (double_colon){				idx1=i;				i=0;				if (addr==addr_end) goto error_colons;				addr=addr_end;			}else{				double_colon=1;				addr[i]=htons(addr[i]);				i++;			}		}else if ((hex=HEX2I(*str))>=0){				addr[i]=addr[i]*16+hex;				double_colon=0;		}else{			/* error, unknown char */			goto error_char;		}	}	if (no_colons<2) goto error_too_few_colons;	if (!double_colon){ /* not ending in ':' */		addr[i]=htons(addr[i]);		i++; 	}	rest=8-i-idx1;	memcpy(addr_start+idx1+rest, addr_end, i*sizeof(unsigned short));	return &ip;error_too_many_colons:	DBG("str2ip6: ERROR: too many colons in [%.*s]\n", (int) len, init);	return 0;error_too_few_colons:	DBG("str2ip6: ERROR: too few colons in [%.*s]\n", (int) len, init);	return 0;error_colons:	DBG("str2ip6: ERROR: too many double colons in [%.*s]\n", (int) len, init);	return 0;error_char:	DBG("str2ip6: WARNING: unexpected char %c in  [%.*s]\n", *str, (int) len,			init);	return 0;}