rem: tuple->state = PS_UNKNOWN; tuple->contact.s = ((char*)tuple) + sizeof(presence_tuple_t); tuple->status.s = tuple->status_buf; strncpy(tuple->contact.s, _contact->s, _contact->len); tuple->contact.s[_contact->len] = 0; tuple->contact.len = _contact->len; tuple->location.loc.s = tuple->location.loc_buf; tuple->location.site.s = tuple->location.site_buf; tuple->location.floor.s = tuple->location.floor_buf; tuple->location.room.s = tuple->location.room_buf; tuple->location.packet_loss.s = tuple->location.packet_loss_buf; tuple->id.s = tuple->id_buf; tuple->expires = expires; tuple->priority = default_priority;
add: tuple->state = PS_UNKNOWN; tuple->contact.s = ((char*)tuple) + sizeof(presence_tuple_t); tuple->status.s = tuple->status_buf; strncpy(tuple->contact.s, _contact->s, _contact->len); tuple->contact.s[_contact->len] = 0; tuple->contact.len = _contact->len; tuple->location.loc.s = tuple->location.loc_buf; tuple->location.site.s = tuple->location.site_buf; tuple->location.floor.s = tuple->location.floor_buf; tuple->location.room.s = tuple->location.room_buf; tuple->location.packet_loss.s = tuple->location.packet_loss_buf; tuple->id.s = tuple->id_buf; tuple->expires = expires; tuple->priority = default_priority; tuple->is_published = is_published;
context: int new_presence_tuple(str* _contact, time_t expires, presentity_t *_p, presence_tuple_t ** _t){     presence_tuple_t* tuple;     int size = 0;     int r;     if (!_contact || !_t) {	  paerrno = PA_INTERNAL_ERROR;	  LOG(L_ERR, "new_presence_tuple(): Invalid parameter value\n");	  return -1;     }     size = sizeof(presence_tuple_t) + _contact->len + 1;     tuple = (presence_tuple_t*)shm_malloc(size);     if (!tuple) {	  paerrno = PA_NO_MEMORY;	  LOG(L_ERR, "new_presence_tuple(): No memory left: size=%d\n", size);	  return -1;     }     memset(tuple, 0, sizeof(presence_tuple_t));     tuple->state = PS_UNKNOWN;     tuple->contact.s = ((char*)tuple) + sizeof(presence_tuple_t);     tuple->status.s = tuple->status_buf;     strncpy(tuple->contact.s, _contact->s, _contact->len);     tuple->contact.s[_contact->len] = 0;     tuple->contact.len = _contact->len;     tuple->location.loc.s = tuple->location.loc_buf;     tuple->location.site.s = tuple->location.site_buf;     tuple->location.floor.s = tuple->location.floor_buf;     tuple->location.room.s = tuple->location.room_buf;     tuple->location.packet_loss.s = tuple->location.packet_loss_buf;     tuple->id.s = tuple->id_buf;     tuple->expires = expires;     tuple->priority = default_priority;     r = rand() + time(NULL);     tuple->id.len = sprintf(tuple->id.s, "tid%x", r);     *_t = tuple;     LOG(L_ERR, "new_tuple=%p for aor=%.*s contact=%.*s id=%.*s\n", tuple, 	 _p->uri.len, _p->uri.s,	 tuple->contact.len, tuple->contact.s,	 tuple->id.len, tuple->id.s);	     return 0;}