clones attribute-set without SI values
| 371 | |
| 372 | // clones attribute-set without SI values |
| 373 | AttributeSet AttributeSet_ShallowClone |
| 374 | ( |
| 375 | const AttributeSet set // set to clone |
| 376 | ) { |
| 377 | // in case attribute-set is marked as read-only, clear marker |
| 378 | AttributeSet _set = (AttributeSet)ATTRIBUTE_SET_CLEAR_MSB(set); |
| 379 | |
| 380 | if(_set == NULL) return NULL; |
| 381 | |
| 382 | size_t n = ATTRIBUTESET_BYTE_SIZE(set); |
| 383 | AttributeSet clone = rm_malloc(n); |
| 384 | clone->attr_count = _set->attr_count; |
| 385 | |
| 386 | for(uint16_t i = 0; i < _set->attr_count; ++i) { |
| 387 | Attribute *attr = _set->attributes + i; |
| 388 | Attribute *clone_attr = clone->attributes + i; |
| 389 | |
| 390 | clone_attr->id = attr->id; |
| 391 | clone_attr->value = SI_ShareValue(attr->value); |
| 392 | } |
| 393 | |
| 394 | return clone; |
| 395 | } |
| 396 | |
| 397 | // persists all attributes within given set |
| 398 | void AttributeSet_PersistValues |
no test coverage detected