rem: presentity->location.len = location.len; presentity->location.s = location.s;
add: presentity->location.loc.len = location.len; strncpy(presentity->location.loc.s, location.s, location.len); presentity->location.loc.s[location.len] = 0; } if (site.len && site.s) { if (presentity->location.site.len && strcmp(presentity->location.site.s, site.s) != 0) changed = 1; presentity->location.site.len = site.len; strncpy(presentity->location.site.s, site.s, site.len); presentity->location.site.s[site.len] = 0; } if (floor.len && floor.s) { if (presentity->location.floor.len && strcmp(presentity->location.floor.s, floor.s) != 0) changed = 1; presentity->location.floor.len = floor.len; strncpy(presentity->location.floor.s, floor.s, floor.len); presentity->location.floor.s[floor.len] = 0; } if (room.len && room.s) { if (presentity->location.room.len && strcmp(presentity->location.room.s, room.s) != 0) changed = 1; presentity->location.room.len = room.len; strncpy(presentity->location.room.s, room.s, room.len); presentity->location.room.s[room.len] = 0; } if (x) { if (presentity->location.x != x) changed = 1; presentity->location.x = x; } if (y) { if (presentity->location.y != y) changed = 1; presentity->location.y = y; } if (radius) { if (presentity->location.radius != radius) changed = 1; presentity->location.radius = radius;
context: static int publish_presentity(struct sip_msg* _m, struct pdomain* _d, 			     struct presentity* presentity, int *pchanged){	char *body = get_body(_m);	str basic;	str location;	int changed = 0;	int ret = 0;	parse_pidf(body, &basic, &location);	LOG(L_INFO, "publish_presentity: -1-\n");	if (basic.len && basic.s) {		int origstate = presentity->state;		presentity->state =			(strcmp(basic.s, "online") == 0) ? PS_ONLINE : PS_OFFLINE;		if (presentity->state != origstate)			changed = 1;	}	LOG(L_INFO, "publish_presentity: -2-\n");	if (location.len && location.s) {		if (presentity->location.len && strcmp(presentity->location.s, location.s) != 0)			changed = 1;		presentity->location.len = location.len;		presentity->location.s = location.s;	}	LOG(L_INFO, "publish_presentity: -3-\n");	if (pchanged && changed) {		*pchanged = 1;	}	if ((ret = db_update_presentity(presentity)) < 0) {		return ret;	}	LOG(L_INFO, "publish_presentity: -4-\n");	return 0;}