On Wed, Feb 25, 2026 at 04:54:31PM -0800, Song Liu wrote:
> +/*
> + * Returns desired length of the demangled name.
> + * If name doesn't need demangling, return strlen(name).
> + */
> +static ssize_t demangled_name_len(const char *name)
> +{
> +     ssize_t len;
> +
> +     if (!strstarts(name, "__UNIQUE_ID_") && !strchr(name, '.'))
> +             return strlen(name);
> +
> +     for (len = strlen(name) - 1; len >= 0; len--) {
> +             char c = name[len];
> +
> +             if (!isdigit(c) && c != '.' && c != '_')
> +                     break;
> +     }
> +     if (len <= 0)
> +             return strlen(name);
> +     return len;
> +}

This actually returns the index of the last char rather than the length.
Should "len" be renamed to "idx" and then it can return "idx + 1"?

-- 
Josh

Reply via email to