Print this page
cleanup


 511 #endif /* DEBUG */
 512         }
 513 
 514         if (selfp->cycleno != 0)
 515                 (void) printf("\t<cycle %d>", selfp->cycleno);
 516 
 517         if (selfp->index != 0) {
 518                 if (selfp->printflag)
 519                         (void) printf(" [%d]", selfp->index);
 520                 else
 521                         (void) printf(" (%d)", selfp->index);
 522         }
 523 
 524         if (c != selfp->name)
 525                 free((void *)c);
 526 }
 527 
 528 void
 529 print_demangled_name(int n, nltype *selfp)
 530 {
 531         char *c = demangled_name(selfp);
 532         int i;
 533 
 534         if (c == selfp->name)
 535                 return;
 536 
 537         (void) printf("\n");
 538         for (i = 1; i < n; i++)
 539                 (void) printf(" ");
 540         (void) printf("[%s]", selfp->name);
 541 
 542         free((void *)c);
 543 }
 544 
 545 void
 546 sortchildren(nltype *parentp)
 547 {
 548         arctype *arcp;
 549         arctype *detachedp;
 550         arctype sorted;
 551         arctype *prevp;
 552 
 553         /*
 554          *      unlink children from parent,
 555          *      then insertion sort back on to sorted's children.
 556          *          *arcp       the arc you have detached and are inserting.
 557          *          *detachedp  the rest of the arcs to be sorted.
 558          *          sorted      arc list onto which you insertion sort.
 559          *          *prevp      arc before the arc you are comparing.
 560          */
 561         sorted.arc_childlist = 0;
 562 


1023                                         (void) printf("%6.6s ", peterbuffer);
1024                                         (void) sprintf(peterbuffer,
1025                                             "<cycle %d>", nlp->cycleno);
1026                                         (void) printf("%-19.19s", peterbuffer);
1027                                 }
1028                         }
1029                 } else {
1030                         nlp = namesortnlp[i];
1031 
1032                         if (nlp->printflag)
1033                                 (void) sprintf(peterbuffer, "[%d]", nlp->index);
1034                         else
1035                                 (void) sprintf(peterbuffer, "(%d)", nlp->index);
1036 
1037                         if (i < nnames) {
1038                                 const char *d = demangled_name(nlp);
1039 
1040                                 if (does_clash(namesortnlp, i, nnames)) {
1041                                         (void) printf("%6.6s %d:%s\n",
1042                                             peterbuffer, nlp->module->id, d);
1043                                 } else
1044                                         (void) printf("%6.6s %s\n", peterbuffer,
1045                                             d);

1046 
1047                                 if (d != nlp->name)
1048                                         (void) printf("%6.6s   [%s]", "",
1049                                             nlp->name);


1050                         } else {
1051                                 (void) printf("%6.6s ", peterbuffer);
1052                                 (void) sprintf(peterbuffer, "<cycle %d>",
1053                                     nlp->cycleno);
1054                                 (void) printf("%-33.33s", peterbuffer);
1055                         }
1056                 }
1057                 (void) printf("\n");
1058         }
1059         free(namesortnlp);
1060 }


 511 #endif /* DEBUG */
 512         }
 513 
 514         if (selfp->cycleno != 0)
 515                 (void) printf("\t<cycle %d>", selfp->cycleno);
 516 
 517         if (selfp->index != 0) {
 518                 if (selfp->printflag)
 519                         (void) printf(" [%d]", selfp->index);
 520                 else
 521                         (void) printf(" (%d)", selfp->index);
 522         }
 523 
 524         if (c != selfp->name)
 525                 free((void *)c);
 526 }
 527 
 528 void
 529 print_demangled_name(int n, nltype *selfp)
 530 {
 531         char *c = (char *)demangled_name(selfp);
 532         int i;
 533 
 534         if (c == selfp->name)
 535                 return;
 536 
 537         (void) printf("\n");
 538         for (i = 1; i < n; i++)
 539                 (void) printf(" ");
 540         (void) printf("[%s]", selfp->name);
 541 
 542         free(c);
 543 }
 544 
 545 void
 546 sortchildren(nltype *parentp)
 547 {
 548         arctype *arcp;
 549         arctype *detachedp;
 550         arctype sorted;
 551         arctype *prevp;
 552 
 553         /*
 554          *      unlink children from parent,
 555          *      then insertion sort back on to sorted's children.
 556          *          *arcp       the arc you have detached and are inserting.
 557          *          *detachedp  the rest of the arcs to be sorted.
 558          *          sorted      arc list onto which you insertion sort.
 559          *          *prevp      arc before the arc you are comparing.
 560          */
 561         sorted.arc_childlist = 0;
 562 


1023                                         (void) printf("%6.6s ", peterbuffer);
1024                                         (void) sprintf(peterbuffer,
1025                                             "<cycle %d>", nlp->cycleno);
1026                                         (void) printf("%-19.19s", peterbuffer);
1027                                 }
1028                         }
1029                 } else {
1030                         nlp = namesortnlp[i];
1031 
1032                         if (nlp->printflag)
1033                                 (void) sprintf(peterbuffer, "[%d]", nlp->index);
1034                         else
1035                                 (void) sprintf(peterbuffer, "(%d)", nlp->index);
1036 
1037                         if (i < nnames) {
1038                                 const char *d = demangled_name(nlp);
1039 
1040                                 if (does_clash(namesortnlp, i, nnames)) {
1041                                         (void) printf("%6.6s %d:%s\n",
1042                                             peterbuffer, nlp->module->id, d);
1043                                 } else {
1044                                         (void) printf("%6.6s %s\n", peterbuffer,
1045                                             d);
1046                                 }
1047 
1048                                 if (d != nlp->name) {
1049                                         (void) printf("%6.6s   [%s]", "",
1050                                             nlp->name);
1051                                         free((void *)d);
1052                                 }
1053                         } else {
1054                                 (void) printf("%6.6s ", peterbuffer);
1055                                 (void) sprintf(peterbuffer, "<cycle %d>",
1056                                     nlp->cycleno);
1057                                 (void) printf("%-33.33s", peterbuffer);
1058                         }
1059                 }
1060                 (void) printf("\n");
1061         }
1062         free(namesortnlp);
1063 }