Print this page
libconv

*** 20,33 **** */ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - #pragma ident "%Z%%M% %I% %E% SMI" - #include <ctype.h> #include <string.h> #include <sys/param.h> #include <stdlib.h> #include "conv.h" --- 20,33 ---- */ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2018 Jason King */ #include <ctype.h> #include <string.h> #include <sys/param.h> #include <stdlib.h> #include "conv.h"
*** 498,510 **** { const char *c; c = demangled_name(selfp); if (selfp->name != 0) { - if (!Cflag) - (void) printf("%s", selfp->name); - else (void) printf("%s", c); #ifdef DEBUG if (debug & DFNDEBUG) (void) printf("{%d} ", selfp->toporder); --- 498,507 ----
*** 521,548 **** if (selfp->printflag) (void) printf(" [%d]", selfp->index); else (void) printf(" (%d)", selfp->index); } } void print_demangled_name(int n, nltype *selfp) { ! char *c; int i; ! c = selfp->name; ! ! if (strcmp(c, demangled_name(selfp)) == 0) return; ! else { (void) printf("\n"); for (i = 1; i < n; i++) (void) printf(" "); (void) printf("[%s]", selfp->name); ! } } void sortchildren(nltype *parentp) { --- 518,547 ---- if (selfp->printflag) (void) printf(" [%d]", selfp->index); else (void) printf(" (%d)", selfp->index); } + + if (c != selfp->name) + free((void *)c); } void print_demangled_name(int n, nltype *selfp) { ! char *c = demangled_name(selfp); int i; ! if (c == selfp->name) return; ! (void) printf("\n"); for (i = 1; i < n; i++) (void) printf(" "); (void) printf("[%s]", selfp->name); ! ! free((void *)c); } void sortchildren(nltype *parentp) {
*** 880,902 **** } void striped_name(char *s, nltype **npp) { ! const char *d; char *c; c = (char *)s; ! d = demangled_name(*npp); while ((*d != '(') && (*d != '\0')) { if (*d != ':') *c++ = *d++; else d++; } *c = '\0'; } /* * Checks if the current symbol name is the same as its neighbour and * returns TRUE if it is. --- 879,904 ---- } void striped_name(char *s, nltype **npp) { ! const char *name, *d; char *c; c = (char *)s; ! name = d = demangled_name(*npp); while ((*d != '(') && (*d != '\0')) { if (*d != ':') *c++ = *d++; else d++; } *c = '\0'; + + if ((*npp)->name != name) + free((void *)name); } /* * Checks if the current symbol name is the same as its neighbour and * returns TRUE if it is.