[Patch/libiberty]: Rewrite of ada_demangle

Ian Lance Taylor iant@google.com
Mon Jan 4 21:51:00 GMT 2010


> include/
> 2009-12-09  Tristan Gingold  <gingold@adacore.com>
>
>        * demangle.h (ada_demangle): Add prototype.
>
> libiberty/
> 2009-12-09  Tristan Gingold  <gingold@adacore.com>
>
>        * cplus-dem.c (ada_demangle): Remove prototype.
>        (grow_vect): Removed.
>        (ada_demangle): Rewritten.
>        (cplus_demangle): Fix indentation.
>        * testsuite/demangle-expected: Add tests for Ada.



> +              int l = strlen (operators[k][0]);
> +              if (!strncmp (p, operators[k][0], l))

Please write strncmp (p, operators[k][0], l) == 0.

The variable name "l" may be confusing in a code sequence which also
uses "1".  You may want to consider renaming the variable to be "len"
or something along those lines.

> +          /* Operator not found.  */
> +          if (!operators[k][0])
> +            goto unknown;

Please write operators[k][0] == NULL.

This is OK with those changes, assuming it passes a gcc bootstrap.

Thanks.

Ian



More information about the Binutils mailing list