Print this page
Address Robert's feedback


  38                 return (SYSDEM_LANG_AUTO);
  39         }
  40 
  41         /* why they use ___Z sometimes is puzzling.. *sigh* */
  42         if (str[2] == '_' && str[3] == 'Z')
  43                 return (SYSDEM_LANG_CPP);
  44 
  45         return (SYSDEM_LANG_AUTO);
  46 }
  47 
  48 char *
  49 sysdemangle(const char *str, sysdem_lang_t lang, sysdem_ops_t *ops)
  50 {
  51 
  52         if (ops == NULL)
  53                 ops = sysdem_ops_default;
  54 
  55         if (lang == SYSDEM_LANG_AUTO) {
  56                 lang = detect_lang(str);
  57                 if (lang == SYSDEM_LANG_AUTO) {
  58                         errno = ENOSYS;
  59                         return (NULL);
  60                 }
  61         }
  62 
  63         switch (lang) {


  64         case SYSDEM_LANG_CPP:
  65                 return (cpp_demangle(str, ops));
  66 
  67         default:
  68                 break;
  69         }
  70 
  71         /* XXX: better return value? */
  72         errno = ENOSYS;
  73         return (NULL);
  74 }


  38                 return (SYSDEM_LANG_AUTO);
  39         }
  40 
  41         /* why they use ___Z sometimes is puzzling.. *sigh* */
  42         if (str[2] == '_' && str[3] == 'Z')
  43                 return (SYSDEM_LANG_CPP);
  44 
  45         return (SYSDEM_LANG_AUTO);
  46 }
  47 
  48 char *
  49 sysdemangle(const char *str, sysdem_lang_t lang, sysdem_ops_t *ops)
  50 {
  51 
  52         if (ops == NULL)
  53                 ops = sysdem_ops_default;
  54 
  55         if (lang == SYSDEM_LANG_AUTO) {
  56                 lang = detect_lang(str);
  57                 if (lang == SYSDEM_LANG_AUTO) {
  58                         errno = ENOTSUP;
  59                         return (NULL);
  60                 }
  61         }
  62 
  63         switch (lang) {
  64         case SYSDEM_LANG_AUTO:
  65                 break;
  66         case SYSDEM_LANG_CPP:
  67                 return (cpp_demangle(str, ops));



  68         }
  69 
  70         errno = ENOTSUP;

  71         return (NULL);
  72 }