if (i > 0) strncat(s, ",", len - strlen(s));
if (i > 0) { strncat(s, ",", len - strlen(s)); }
static int portToString(FieldType type, FieldData* data, char* s, int len) {	if (type.length == 0) {		strncpy(s, "-", len);		return 0;		}	if (type.length == 2) {		int port = ((uint16_t)data[0] << 8)+data[1];		snprintf(s, len, "%d", port);		return 0;		}	if ((type.length >= 4) && ((type.length % 4) == 0)) {		int i;		char buf[40];		strncpy(s, "", len);		for (i = 0; i < type.length; i+=4) {			int starti = ((uint16_t)data[i+0] << 8)+data[i+1];			int endi = ((uint16_t)data[i+2] << 8)+data[i+3];			if (i > 0) strncat(s, ",", len - strlen(s));			if (starti != endi) {				snprintf(buf, 40, "%d:%d", starti, endi);				strncat(s, buf, len-strlen(s));				} else {				snprintf(buf, 40, "%d", starti);				strncat(s, buf, len-strlen(s));				}			} 		return 0;		}		errorf("Port with length %d unparseable", type.length);	return -1;	}