Changes in uspace/app/sbi/src/rdata.c [051bc69a:38aaacc2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/rdata.c
r051bc69a r38aaacc2 52 52 #include "stree.h" 53 53 #include "symbol.h" 54 #include "strtab.h"55 54 56 55 #include "rdata.h" … … 62 61 static void rdata_ref_copy(rdata_ref_t *src, rdata_ref_t **dest); 63 62 static void rdata_deleg_copy(rdata_deleg_t *src, rdata_deleg_t **dest); 64 static void rdata_enum_copy(rdata_enum_t *src, rdata_enum_t **dest);65 63 static void rdata_array_copy(rdata_array_t *src, rdata_array_t **dest); 66 64 static void rdata_object_copy(rdata_object_t *src, rdata_object_t **dest); 67 65 static void rdata_resource_copy(rdata_resource_t *src, 68 66 rdata_resource_t **dest); 69 static void rdata_symbol_copy(rdata_symbol_t *src, rdata_symbol_t **dest);70 67 71 68 static int rdata_array_get_dim(rdata_array_t *array); … … 250 247 251 248 return deleg; 252 }253 254 /** Allocate new enum value.255 *256 * @return New enum value.257 */258 rdata_enum_t *rdata_enum_new(void)259 {260 rdata_enum_t *enum_v;261 262 enum_v = calloc(1, sizeof(rdata_enum_t));263 if (enum_v == NULL) {264 printf("Memory allocation failed.\n");265 exit(1);266 }267 268 return enum_v;269 249 } 270 250 … … 393 373 394 374 return resource_v; 395 }396 397 /** Allocate new symbol reference.398 *399 * @return New symbol reference.400 */401 rdata_symbol_t *rdata_symbol_new(void)402 {403 rdata_symbol_t *symbol_v;404 405 symbol_v = calloc(1, sizeof(rdata_symbol_t));406 if (symbol_v == NULL) {407 printf("Memory allocation failed.\n");408 exit(1);409 }410 411 return symbol_v;412 375 } 413 376 … … 490 453 rdata_deleg_copy(src->u.deleg_v, &nvar->u.deleg_v); 491 454 break; 492 case vc_enum:493 rdata_enum_copy(src->u.enum_v, &nvar->u.enum_v);494 break;495 455 case vc_array: 496 456 rdata_array_copy(src->u.array_v, &nvar->u.array_v); … … 501 461 case vc_resource: 502 462 rdata_resource_copy(src->u.resource_v, &nvar->u.resource_v); 503 break;504 case vc_symbol:505 rdata_symbol_copy(src->u.symbol_v, &nvar->u.symbol_v);506 463 break; 507 464 } … … 577 534 } 578 535 579 /** Copy enum value.580 *581 * @param src Source enum value.582 * @param dest Place to store pointer to new enum value.583 */584 static void rdata_enum_copy(rdata_enum_t *src, rdata_enum_t **dest)585 {586 *dest = rdata_enum_new();587 (*dest)->value = src->value;588 }589 590 536 /** Copy array. 591 537 * … … 621 567 *dest = rdata_resource_new(); 622 568 (*dest)->data = src->data; 623 }624 625 /** Copy symbol.626 *627 * @param src Source symbol.628 * @param dest Place to store pointer to new symbol.629 */630 static void rdata_symbol_copy(rdata_symbol_t *src, rdata_symbol_t **dest)631 {632 *dest = rdata_symbol_new();633 (*dest)->sym = src->sym;634 569 } 635 570 … … 686 621 case vc_ref: var->u.ref_v = nvar->u.ref_v; break; 687 622 case vc_deleg: var->u.deleg_v = nvar->u.deleg_v; break; 688 case vc_enum: var->u.enum_v = nvar->u.enum_v; break;689 623 case vc_array: var->u.array_v = nvar->u.array_v; break; 690 624 case vc_object: var->u.object_v = nvar->u.object_v; break; 691 625 case vc_resource: var->u.resource_v = nvar->u.resource_v; break; 692 case vc_symbol: var->u.symbol_v = nvar->u.symbol_v; break;693 626 } 694 627 … … 799 732 printf(")"); 800 733 break; 801 case vc_enum:802 symbol_print_fqn(803 enum_to_symbol(var->u.enum_v->value->outer_enum));804 printf(".%s",805 strtab_get_str(var->u.enum_v->value->name->sid));806 break;807 734 case vc_array: 808 735 printf("array"); … … 814 741 printf("resource(%p)", var->u.resource_v->data); 815 742 break; 816 case vc_symbol: 817 printf("symbol("); 818 if (var->u.symbol_v->sym != NULL) { 819 symbol_print_fqn(var->u.symbol_v->sym); 820 } else { 821 printf("nil"); 822 } 823 printf(")"); 824 break; 825 } 826 } 743 } 744 }
Note:
See TracChangeset
for help on using the changeset viewer.